Creating a managed disk with IOPS and Throughout using the Azure golang SDK on Premium SSD v2 not supported
Hi,
I am trying to connect to Azure and create a managed disk with custom IOPS and Throughput (for Premium SSD v2) using the Azure Go lang SDK. These are the following versions of SDK in my environment:
github.com/Azure/azure-sdk-for-go v58.0.0+incompatible
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0
github.com/Azure/azure-sdk-for-go/sdk/data/aztables v1.1.0
github.com/Azure/azure-sdk-for-go/sdk/keyvault/azkeys v0.5.1
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 v5.2.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4 v4.3.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns v1.1.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/graphservices/armgraphservices v0.1.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/logic/armlogic v1.2.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi v1.1.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4 v4.2.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v4 v4.0.0-beta.1
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns v1.1.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions v1.2.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.0.0
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.0.1
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.0.0
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.5.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.0.0 // indirect
I am able to create a managed disk of different types with custom sizes. However, I am unable to find how I can specify an IOPS or Throughput on the Disk. The piece of code I am using is
// Only for Data disks as Azure only supports Data Disks on Premium SSD v2
for i := uint32(0); i < diskConfig.NumDiskPerNode; i++ {
disks[i] = requests.DataDisk{
Lun: int32(i),
Caching: string(cacheType),
WriteAcceleratorEnabled: false,
ManagedDisk: requests.ManagedDiskParameters{
StorageAccountTypes: diskConfig.DiskType.String(),
},
ToBeDetached: false,
DeleteOption: string(armcompute.DiskDeleteOptionTypesDelete),
DiskSizeInGB: int32(diskConfig.DiskSizeGB),
CreateOption: string(armcompute.DiskCreateOptionEmpty),
}
if diskConfig.DiskType.String() == "PremiumV2_LRS" {
disks[i].DiskIOPSReadWrite = "3000"))
disks[i].DiskMBpsReadWrite = "300")
}
}
These are the errors I get:
--------------------------------------------------------------------------------
RESPONSE 400: 400 Bad Request
ERROR CODE: InvalidParameter
--------------------------------------------------------------------------------
{
"error": {
"code": "InvalidParameter",
"message": "Property 'dataDisk.diskIOPSReadWrite' can be enabled only on VMs in a Virtual Machine Scale Set.",
"target": "dataDisk.diskIOPSReadWrite"
}
}
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
RESPONSE 400: 400 Bad Request
ERROR CODE: InvalidParameter
--------------------------------------------------------------------------------
{
"error": {
"code": "InvalidParameter",
"message": "Property 'dataDisk.DiskMBpsReadWrite' can be enabled only on VMs in a Virtual Machine Scale Set.",
"target": "dataDisk.DiskMBpsReadWrite"
}
}
--------------------------------------------------------------------------------
I confirmed from the latest version of the SDK as well that these operations are not supported from the SDK.
// READ-ONLY; Specifies the Read-Write IOPS for the managed disk when StorageAccountType is UltraSSD_LRS. Returned only for
// VirtualMachine ScaleSet VM disks. Can be updated only via updates to the VirtualMachine
// Scale Set.
DiskIOPSReadWrite *int64 `json:"diskIOPSReadWrite,omitempty" azure:"ro"`
// READ-ONLY; Specifies the bandwidth in MB per second for the managed disk when StorageAccountType is UltraSSD_LRS. Returned
// only for VirtualMachine ScaleSet VM disks. Can be updated only via updates to the
// VirtualMachine Scale Set.
DiskMBpsReadWrite *int64 `json:"diskMBpsReadWrite,omitempty" azure:"ro"`
However, I am comfortably able to create a Disk on PremiumV2_LRS on Azure Portal. Further, on the disks I create through the SDK, I am able to increase its throughput and IOPS through a Power shell script I run on Azure Portal
$subscriptionId = "<my-subscription>"
$resourceGroup = "<my-resourceGroup>"
$diskName = "<my-disk>"
Select-AzSubscription -SubscriptionId $subscriptionId
$diskUpdateConfig = New-AzDiskUpdateConfig -DiskIOPSReadWrite 3000 -DiskMBpsReadWrite 300
Update-AzDisk -ResourceGroupName $resourceGroup -DiskName $diskName -DiskUpdate $diskUpdateConfig
I have no way of finding how to set IOPS and Throughput on my call to create a disk. Is it something that only supported via REST API client/Azure Portal and not the SDK? If not, I would want to request support be extended for it in the Azure SDK (since its clearly supported in the portal)
Any guidance would be helpful.