Change hardware generation on Managed Instance

Hardware generation on 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 instances if you are 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 = "****"

$admin_login = "******"
$admin_pass = "******"
$location = "***** # for example: ""northeurope"

$vCores = 8
$maxStorage = 1024
$license = "BasePrice"

$subnetId = "/subscriptions/****/subnets/*******"

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

$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"

Put the subscription id, subnet id, name, and resource group of the managed instance. You should use the same parameters for vCores and as you already have on the existing Managed Instance or you can change them too.

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

 

This article was originally published by Clustering For Mere Mortals. You can find the original article here.