SQL Server 2019 Standard on Ubuntu 20.04 LTS | cloudimg
SQL Server 2019 Standard on Ubuntu 20.04 LTS
Microsoft SQL Server 2019 Standard Edition on Ubuntu 20.04 LTS (Focal Fossa), purpose-built for Azure by cloudimg. A unique SA password is generated automatically on every VM deployment — no credential is baked into the image. The SQL Server Standard software license is not included; you apply your own product key after deployment.
Important: This image charges for cloudimg packaging, maintenance, and 24/7 expert support at $0.04 per vCPU per hour. The SQL Server 2019 Standard Edition software license is not included. You must hold and apply a valid SQL Server 2019 Standard Edition product key — see Step 6.
Prerequisites
- An Azure subscription with permission to create virtual machines
- An SSH key pair — the public key is uploaded during VM creation
- A valid SQL Server 2019 Standard Edition product key (BYOL) for production use
Step 1 — Deploy from the Azure Portal
- Find SQL Server 2019 Standard on Ubuntu 20.04 LTS by cloudimg in the Azure Marketplace and click Create.
- On the Basics tab, select or create a Resource Group, choose a region, and set the VM size. Standard_D4s_v3 (4 vCPU / 16 GB RAM) is recommended for most production workloads. SQL Server 2019 Standard Edition supports up to 24 cores and 128 GB RAM.
- Under Administrator account, choose SSH public key and paste your public key.
- On the Networking tab, open inbound port 1433 (SQL Server) in addition to 22 (SSH).
- Click Review + create, then Create.
Step 2 — Deploy with the Azure CLI
az vm create \
--resource-group <your-resource-group> \
--name mssql-2019-standard \
--image "$(az sig image-version list \
--resource-group AZURE-CLOUDIMG \
--gallery-name cloudimgGallery \
--gallery-image-definition mssql-2019-standard-ubuntu-20-04 \
--query '[0].id' -o tsv)" \
--size Standard_D4s_v3 \
--admin-username azureuser \
--ssh-key-values ~/.ssh/id_rsa.pub \
--public-ip-sku Standard
After the VM starts, open the SQL Server port:
az vm open-port --port 1433 --resource-group <your-resource-group> --name mssql-2019-standard
Step 3 — Connect via SSH
ssh azureuser@<vm-ip>
On first boot, mssql-firstboot.service generates a unique SA password, creates the cloudimg database and login, and writes credentials to /stage/scripts/mssql-credentials.log. Allow 60–90 seconds for the service to complete before connecting.
Step 4 — Retrieve Your Credentials
sudo cat /stage/scripts/mssql-credentials.log
The file is owned root:root (mode 0600) and contains your SA password, cloudimg login password, database name, and a ready-to-use connect command. Store the passwords somewhere safe.
Example output:
# SQL Server 2019 Standard Edition — Per-VM Credentials
# Generated: Thu Apr 23 22:37:47 UTC 2026
#
# NOTE: The SQL Server Standard software license is NOT included.
# Apply your own license key:
# sudo /opt/mssql/bin/mssql-conf setpid <your-product-key>
# sudo systemctl restart mssql-server
#
SA_USER=sa
SA_PASSWORD=Az3f8a2c1d9e7b4f6a!8c2e1d
CLOUDIMG_USER=cloudimg
CLOUDIMG_PASSWORD=Cl7e4a1b9c2d8f3e5a!4b1c9
CLOUDIMG_DATABASE=cloudimg
#
# Connect: sqlcmd -S localhost -U sa -P 'Az3f8a2c1d9e7b4f6a!8c2e1d' -C
Step 5 — Connect with sqlcmd
Read the generated SA password and open an interactive sqlcmd session:
SA_PASS=$(sudo grep '^SA_PASSWORD=' /stage/scripts/mssql-credentials.log | cut -d= -f2-)
/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "${SA_PASS}" -C
The -C flag trusts the self-signed TLS certificate that SQL Server generates at startup. Confirm the version and edition:
SELECT @@VERSION;
GO
Expected output:
Microsoft SQL Server 2019 (RTM-CU32-GDR) (KB5084816) - 15.0.4465.1 (X64)
Mar 13 2026 01:28:40
Copyright (C) 2019 Microsoft Corporation
Standard Edition (64-bit) on Linux (Ubuntu 20.04.6 LTS) <X64>
Step 6 — Apply Your SQL Server License Key (BYOL)
By default, the image runs in Standard Edition evaluation mode — this is functionally identical to a licensed Standard Edition but requires a product key for production compliance. Apply your own SQL Server 2019 Standard Edition product key:
sudo /opt/mssql/bin/mssql-conf setpid <YOUR-PRODUCT-KEY>
sudo systemctl restart mssql-server
Confirm the edition after restart:
SA_PASS=$(sudo grep '^SA_PASSWORD=' /stage/scripts/mssql-credentials.log | cut -d= -f2-)
/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "${SA_PASS}" -C \
-Q "SELECT SERVERPROPERTY('Edition'), SERVERPROPERTY('LicenseType')"
SQL Server 2019 Standard Edition supports up to 24 cores and 128 GB RAM.
Step 7 — Create Databases and Tables
Create a database, a table, insert a row, and query it back:
SA_PASS=$(sudo grep '^SA_PASSWORD=' /stage/scripts/mssql-credentials.log | cut -d= -f2-)
# Create database
/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "${SA_PASS}" -C \
-Q "IF DB_ID('mydb') IS NULL CREATE DATABASE mydb;"
# Create table, insert, and select
/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "${SA_PASS}" -C -d mydb -W -Q "
CREATE TABLE greetings (id INT IDENTITY(1,1) PRIMARY KEY, msg NVARCHAR(256));
INSERT INTO greetings (msg) VALUES (N'Hello from cloudimg SQL Server 2019');
SELECT id, msg FROM greetings;
"
Expected output:
(1 rows affected)
id msg
-- -----------------------------------
1 Hello from cloudimg SQL Server 2019
(1 rows affected)
The pre-created cloudimg database and cloudimg SQL login (db_owner on the cloudimg database) are available for immediate application use:
CL_PASS=$(sudo grep '^CLOUDIMG_PASSWORD=' /stage/scripts/mssql-credentials.log | cut -d= -f2-)
/opt/mssql-tools18/bin/sqlcmd -S localhost -U cloudimg -P "${CL_PASS}" -C -d cloudimg \
-Q "SELECT DB_NAME(), SUSER_SNAME();"
Step 8 — Open Port 1433 for Remote Access
By default, port 1433 is blocked by the Azure NSG. To allow remote clients:
az network nsg rule create \
--resource-group <your-resource-group> \
--nsg-name <your-nsg-name> \
--name allow-mssql \
--priority 1433 \
--protocol Tcp \
--destination-port-ranges 1433 \
--access Allow
Remote clients then connect with:
sqlcmd -S <vm-ip> -U sa -P '<sa-password>' -C
For production, use a TLS certificate from a trusted CA rather than the self-signed cert — omit -C once you replace the certificate.
Step 9 — Backup and Restore
Back up a database to disk:
SA_PASS=$(sudo grep '^SA_PASSWORD=' /stage/scripts/mssql-credentials.log | cut -d= -f2-)
/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "${SA_PASS}" -C -Q "
BACKUP DATABASE [mydb]
TO DISK = N'/var/opt/mssql/data/mydb.bak'
WITH NOFORMAT, INIT, NAME = N'mydb full backup', STATS = 10;
"
Restore from backup:
SA_PASS=$(sudo grep '^SA_PASSWORD=' /stage/scripts/mssql-credentials.log | cut -d= -f2-)
/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "${SA_PASS}" -C -Q "
RESTORE DATABASE [mydb]
FROM DISK = N'/var/opt/mssql/data/mydb.bak'
WITH REPLACE;
"
Step 10 — Server Components
| Component | Value |
|---|---|
| Package | mssql-server 15.0.x from Microsoft APT (packages.microsoft.com) |
| Edition | Standard Edition (64-bit) |
| Client binary | /opt/mssql-tools18/bin/sqlcmd |
| systemd unit | mssql-server.service |
| First-boot unit | mssql-firstboot.service |
| Default port | 1433 |
| Data directory | /var/opt/mssql/data/ |
| Credential file | /stage/scripts/mssql-credentials.log (mode 0600) |
Step 11 — Filesystem Layout
| Path | Purpose |
|---|---|
/opt/mssql/ |
SQL Server engine binaries |
/opt/mssql-tools18/bin/ |
sqlcmd, bcp, and ODBC tools |
/var/opt/mssql/data/ |
Database files (.mdf, .ldf) |
/var/opt/mssql/log/ |
SQL Server error log |
/etc/systemd/system/mssql-firstboot.service |
First-boot credential generator |
/usr/local/sbin/mssql-firstboot.sh |
First-boot script |
/stage/scripts/mssql-credentials.log |
Generated per-VM credentials (mode 0600) |
Support
cloudimg provides 24/7/365 expert technical support. Guaranteed response within 24 hours, one hour average for critical issues. Contact support@cloudimg.co.uk.
Visit www.cloudimg.co.uk/products for the full catalogue of cloudimg images across AWS and Azure.