Scale down an Azure SQL Managed Instance from Business Critical to General Purpose Tier

With the move to PaaS services, we often become reliant on portals for the administration interface to administer them once deployed. I recently had a request to scale down an Azure SQL Managed Instance from Business Critical to General Purpose tier.

The documentation states that this is possible. Along with noting the following exceptions:

  • Databases using features which are only available in the Business Critical / Premium service tiers, cannot be changed to use the General Purpose / Standard service tier. Currently, the only such feature is In-Memory OLTP.
  • Databases originally created in the Hyperscale service tier cannot be migrated to other service tiers. If you migrate an existing database in Azure SQL Database to the Hyperscale service tier, you can reverse migrate to the General Purpose service tier within 45 days of the original migration to Hyperscale. If you wish to migrate the database to another service tier, such as Business Critical, first reverse migrate to the General Purpose service tier, then perform a further migration.

The gotcha here though is that you can’t down scale an Azure SQL Managed Instance from Business Critical to General Purpose using the Azure Portal. Searching for the Azure CLI command to perform it results in a number of examples, but all for Azure SQL Server, not an Azure SQL Managed Instance.

After some trial and error, I found the command and was able to execute it. I’m documenting it for the next time I need to do it, but also to help anyone else trying to achieve the same thing.

Azure CLI command to down scale an Azure SQL Managed Instance from Business Critical to General Purpose

The following is the Azure CLI command to down scale an Azure SQL Managed Instance. Essentially all you have to do is provide the name of your Azure SQL Managed Instance, the Azure Resource Group that contains it, Storage Size, number of vCores and the edition (GeneralPurpose).

Set-AzSqlInstance -Name "mySQLMI" -ResourceGroupName "RG-myAzureSQLMI" -StorageSizeInGB 256 -VCore 4 -Edition GeneralPurpose

If all you want to do is down scale from Business Critical to General Purpose (i.e. keep the same underlying infrastructure and resource limits), just provide the same values as currently configured. You can get those values by using the following Azure CLI command.

Get-AzSqlInstance -ResourceGroupName "Resource-Group-for-your-AzureSQL-MI" | select -Property VCores, StorageSizeInGB

Configuration Options

  • Azure SQL Managed Instance hardware configuration options for number of vCores
  • Azure SQL Managed Instance Service tiers (e.g. Business Critical or General Purpose)

Summary

You can down scale an Azure SQL Managed Instance using the Azure CLI as long as you aren’t using In-Memory OLTP.