Change hardware generation on Managed Instance
Published Jun 18 2019 02:25 PM 7,124 Views
Microsoft

Hardware generation on Azure SQL Managed Instance defines the characteristics of the underlying hardware resources. Currently, Managed Instance supports two generations Gen4 and Gen5(recommended). Some features are not supported in some generations. As an example, you cannot have 4-core or 32+core instances if you are on Gen4, or you cannot add more 1TB storage for B.... In that case you would need to change the hardware generation of the instance.

 
Updating hardware generation is now supported using Azure Portal, PowerShell command (Set-AzSqlInstance) and Azure CLI command (az sql mi update). Examples can be found on these links as so as on vCore model overview documentation page. This article explains how to use base powershell Set-AzResource comand.

 

The following PowerShell script enables you to change generation on the instance:

 

$subscriptionId = "**************"
Select-AzSubscription -Subscription $subscriptionId

$instanceName = "********"
$resourceGroup = "****"

# THIS IS IMPORTANT PARAMETER:
$sku = @{name = "GP_Gen5" }

# NOTE: These properties are not necessary, but it would be good to set them to the current values:
# You might want to change vCores or storage with hardware generation # $admin_login = "******" # $admin_pass = "******" # $location = "***** # for example: ""northeurope" # $vCores = 8 # $maxStorage = 1024 # $license = "BasePrice" # $subnetId = "/subscriptions/****/subnets/*******" ## NOTE: Uncomment some of the properties below if you have set them. $properties = New-Object System.Object # $properties | Add-Member -type NoteProperty -name subnetId -Value $subnetId # $properties | Add-Member -type NoteProperty -name administratorLogin -Value $admin_login # $properties | Add-Member -type NoteProperty -name administratorLoginPassword -Value $admin_pass # $properties | Add-Member -type NoteProperty -name vCores -Value $vCores # $properties | Add-Member -type NoteProperty -name storageSizeInGB -Value $maxStorage # $properties | Add-Member -type NoteProperty -name licenseType -Value $license Set-AzResource -Properties $properties -ResourceName $instanceName -ResourceType "Microsoft.SQL/managedInstances" -Sku $sku -ResourceGroupName $resourceGroup -Force -ApiVersion "2015-05-01-preview"
# Check the value of hardware generation: (Get-AzSqlInstance -ResourceGroupName $resourceGroup -Name $instanceName).Sku

Make sure to enter your subscription id, name, and resource group of the managed instance.

 

In some cases, properties like license are reset to default when you change service tier/cores (because without setting the parameter Azure cannot always be sure that you still eligible for licence discount for BC or more cores) so it is always better to explicitly set them.

Once you execute this script, the hardware generation will be changed from Gen4 to Gen5.

1 Comment
Version history
Last update:
‎Nov 09 2020 09:42 AM
Updated by: