Change hardware generation on Managed Instance

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 Business Critical tier on Gen4. In that case you would need to change the hardware generation of the instance.


 


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.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.