Azure Container Instance and SQL server

Being heavily involved with Microsoft Azure and database technologies it was only a matter of time that I would enter the world of Azure Container Instances (ACI). The same could be said about AKS – Azure Kubernetes Services, but that for I have used this technology to deploy ML models to. Anyways, going back to ACI – why would you be interested?

This is Microsoft’s serverless technology which allows us to deploy containers without having to worry about managing the underlying hardware. It’s a way to get access to SQL fast (faster than traditional methods like installing a virtual machine) to do things like test code fixes etc.

There a couple of ways of doing this, you can use the portal, PowerShell or Azure CLI, I actually like Azure CLI.

Load up Azure CLI and switch to bash.

run: $ az group create -l westeurope -n acisql

Now I create the container with my image and its definitions.

az container create –image mcr.microsoft.com/mssql/server:2019-latest  –name mssql-2019 –resource-group acisql –cpu 2 –memory 3.5 –port 1433 –ip-address public -e ACCEPT_EULA=Y MSSQL_SA_PASSWORD=fakepasswordhere111 MSSQL_PID=Developer MSSQL_COLLATION=Latin1_General_CI_AS MSSQL_ENABLE_HADR=Y –location westeurope  –dns-name-label sqlservercloud

In real world scenarios you will not want to open this as a public IP over the default SQL port, its madness but for this testing and this blog post, I will. For proper setup you will want to leverage vnets as per: https://docs.microsoft.com/en-us/azure/container-instances/container-instances-vnet. The rest is self-explanatory, it states the edition of SQL you want, collation, how much RAM etc.

Anyways, the point of this post is the flexibility and ease of getting access to SQL. So, how do we connect? Via SSMS is possible using <nameofimage><location><azurecontainer.io> via SQL auth.

Run:

SELECT @@SERVERNAME

SELECT @@version

What does the Azure portal look like?

You can stop and delete it too if needed.

2 thoughts on “Azure Container Instance and SQL server

  1. Pingback: Dew Drop – July 5, 2021 (#3477) – Morning Dew by Alvin Ashcraft

  2. Pingback: SQL Server on Azure Container Instances – Curated SQL

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s