Step by Step Installation of the Azure SQL Managed Instance

In August 2018, I have written a blog post regarding Azure SQL Managed Instance which you can read here. This blog post has more than 2700 views so far and has been referred in other blogs as well.

Today in this post I am going to show you how quickly we can create SQL managed instance in Azure.

Important Pre Requisite for the SQL managed instance.

Azure SQL Database Managed Instance must be deployed within an Azure virtual network and the subnet dedicated for Managed Instances only. You can use the existing virtual network and subnet if it’s configured according to the Managed Instance virtual network requirements.

In your enterprise you need to request the network folks to create the new subnet for you before you deploy the first instance of the SQL managed instance.

A PowerShell script which will prepare the subnet is as follows.
$scriptUrlBase = ‘https://raw.githubusercontent.com/Microsoft/sql-server-samples/master/samples/manage/azure-sql-db-managed-instance/prepare-subnet’

$parameters = @{

subscriptionId = ‘<subscriptionId>’

resourceGroupName = ‘<resourceGroupName>’

virtualNetworkName = ‘<virtualNetworkName>’

subnetName = ‘<subnetName>’

}
Invoke-Command -ScriptBlock ([Scriptblock]::Create((iwr ($scriptUrlBase+’/prepareSubnet.ps1?t=’+ [DateTime]::Now.Ticks)).Content)) -ArgumentList $parameters

Once you run this command it will prepare the subnet as you can see below.

It will also add few default route as you can see. You may need a security review since it will create a route where it will point directly to internet instead of your local firewall device as shown below.

In the next step, it will attach the route to the subnet and the subnet is ready.

In the next step, you need to create a network security group and need to assign it to the subnet. As you can see below.

The NSG will have the following inbound rules and the following ports should be allowed

And the following outbound rules

Once it’s done you can start the creation of the SQL managed instance.

You can click on the plus sign in the top right corner of the portal to create a resource and search for Azure SQL Managed Instance and you can see below.

Click on the create button.

In the next step you need to choose the size of the instance, to know more about the size you can refer to my earlier blog here.

In the next step, you need to fill the managed instance details as shown below.

Initially, the first instance will take some time but don’t cancel it. You can check the progress from the notification area.

And more status can be found here.

After waiting for some time you will find that the SQL Managed instance is created and ready for your use.