SQL Server 2019 Enterprise on Ubuntu 20.04 LTS — Azure Guide
SQL Server 2019 Enterprise on Ubuntu 20.04 LTS
This guide covers the cloudimg SQL Server 2019 Enterprise Edition image on Microsoft Azure. The image ships with SQL Server 2019 pre-installed and configured. On first boot a unique SA password is generated for every virtual machine.
Getting Started
1. Deploy from Azure Marketplace
Deploy the image from the Azure Marketplace listing. Recommended VM size: Standard_D4s_v3 (4 vCPU, 16 GB RAM) or larger for production workloads. Open inbound TCP port 1433 in the Network Security Group if you need remote access.
2. SSH to Your VM
ssh azureuser@<VM-PUBLIC-IP>
3. Retrieve Your SA Credentials
The SA password is written to /stage/scripts/mssql-credentials.log on first boot. Read it with:
sudo cat /stage/scripts/mssql-credentials.log
The file contains your SA password and ready-to-use connection strings.
Connecting to SQL Server
Connect Locally (on the VM)
/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P '<your-sa-password>' -C -No
Once connected, run T-SQL directly:
SELECT @@VERSION;
GO
SELECT name FROM sys.databases;
GO
Type exit to disconnect.
Add sqlcmd to Your PATH
echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
source ~/.bashrc
Then connect simply with:
sqlcmd -S localhost -U sa -P '<your-sa-password>' -C -No
Remote Access
Open Port 1433 in the Azure NSG
In the Azure Portal, navigate to your VM → Networking → Add inbound port rule:
- Destination port:
1433 - Protocol:
TCP - Name:
Allow-SQLServer
Restrict the source IP to your application server's CIDR for security.
Connect from Azure Data Studio or SSMS
- Server:
<VM-PUBLIC-IP>,1433 - Authentication: SQL Server Authentication
- Login:
sa - Password:
<your-sa-password> - Trust server certificate: Enabled
Applying Your Enterprise Licence
The image ships in evaluation mode. Apply your Microsoft SQL Server 2019 Enterprise product key to activate your licence:
sudo /opt/mssql/bin/mssql-conf set-edition
Enter your product key when prompted. Then restart SQL Server:
sudo systemctl restart mssql-server
Verify the edition:
sqlcmd -S localhost -U sa -P '<your-sa-password>' -C -No -Q "SELECT SERVERPROPERTY('Edition')"
Database Operations
Create a Database and User
-- Create a database
CREATE DATABASE myapp;
GO
-- Create an application user
USE myapp;
GO
CREATE LOGIN appuser WITH PASSWORD = 'StrongP@ssword1!';
CREATE USER appuser FOR LOGIN appuser;
ALTER ROLE db_owner ADD MEMBER appuser;
GO
Backup a Database
sqlcmd -S localhost -U sa -P '<your-sa-password>' -C -No -Q \
"BACKUP DATABASE myapp TO DISK = '/var/opt/mssql/data/myapp.bak' WITH FORMAT, STATS=10"
Restore a Database
sqlcmd -S localhost -U sa -P '<your-sa-password>' -C -No -Q \
"RESTORE DATABASE myapp FROM DISK = '/var/opt/mssql/data/myapp.bak' WITH REPLACE, STATS=10"
Configuration
The SQL Server configuration file is at /var/opt/mssql/mssql.conf. Edit it with mssql-conf or directly.
Limit Memory Usage
By default SQL Server uses up to 80% of available RAM. Cap it for shared VMs:
sudo /opt/mssql/bin/mssql-conf set memory.memorylimitmb 4096
sudo systemctl restart mssql-server
Set Maximum Degree of Parallelism
sqlcmd -S localhost -U sa -P '<your-sa-password>' -C -No -Q \
"EXEC sp_configure 'max degree of parallelism', 2; RECONFIGURE"
View Current Configuration
sudo cat /var/opt/mssql/mssql.conf
Service Management
# Status
sudo systemctl status mssql-server
# Start
sudo systemctl start mssql-server
# Stop
sudo systemctl stop mssql-server
# Restart
sudo systemctl restart mssql-server
# Enable on boot (already enabled)
sudo systemctl enable mssql-server
# View logs
sudo cat /var/opt/mssql/log/errorlog | tail -50
Support
cloudimg provides 24/7/365 expert technical support with a guaranteed 24-hour response time.
Email: support@cloudimg.co.uk
Visit www.cloudimg.co.uk/products for our full Azure Marketplace catalogue.
SQL Server 2019 Enterprise — cloudimg Azure Marketplace image. Microsoft SQL Server is a trademark of Microsoft Corporation.