はじめに
ライブ サイズ変更機能がGAしました。ちょっと試してみたいと思います。
サイズ変更
分かりやすいように仮想マシンはWindowsを利用しています。
最初にLiveResize機能を登録します。ポータルからは登録できません。
Azure CLI
az feature register --namespace Microsoft.Compute --name LiveResize
PowerShell
Register-AzProviderFeature -FeatureName "LiveResize" -ProviderNamespace "Microsoft.Compute"
WSLから実行しています。
$ az feature register --namespace Microsoft.Compute --name LiveResize
Once the feature 'LiveResize' is registered, invoking 'az provider register -n Microsoft.Compute' is required to get the change propagated
{
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/providers/Microsoft.Features/providers/Microsoft.Compute/features/LiveResize",
"name": "Microsoft.Compute/LiveResize",
"properties": {
"state": "Registering"
},
"type": "Microsoft.Features/providers/features"
}
az disk list \
--resource-group vm3_group \
--query '[*].{Name:name,Gb:diskSizeGb,Tier:accountType}' \
--output table
Name Gb --------------------------------------------- ---- vm3_OsDisk_1_eff21bdd64854025b942975d2b5c3ea1 127
az disk update \
--resource-group vm3_group \
--name vm3_OsDisk_1_eff21bdd64854025b942975d2b5c3ea1 \
--size-gb 256
(OperationNotAllowed) Change in disk property of OS disk '' is not allowed when VM is running. Code: OperationNotAllowed Message: Change in disk property of OS disk '' is not allowed when VM is running.
OS Diskはできないようです・・・
次はデータディスクで試してみます。
事前にディスク管理の画面で確認してみます。
データディスクが128GBです。

ではサイズ変更して256GBにしてみます。
az disk update \
--resource-group vm3_group \
--name datadisk1 \
--size-gb 256
途中経過は表示されません。
サイズによっては時間がかかる可能性もあります。
{
"burstingEnabled": null,
"completionPercent": null,
"creationData": {
"createOption": "Empty",
"galleryImageReference": null,
"imageReference": null,
"logicalSectorSize": null,
"securityDataUri": null,
"sourceResourceId": null,
"sourceUniqueId": null,
"sourceUri": null,
"storageAccountId": null,
"uploadSizeBytes": null
},
"dataAccessAuthMode": null,
"diskAccessId": null,
"diskIopsReadOnly": null,
"diskIopsReadWrite": 1100,
"diskMBpsReadOnly": null,
"diskMBpsReadWrite": 125,
"diskSizeBytes": 274877906944,
"diskSizeGb": 256,
"diskState": "Attached",
"encryption": {
"diskEncryptionSetId": null,
"type": "EncryptionAtRestWithPlatformKey"
},
"encryptionSettingsCollection": null,
"extendedLocation": null,
"hyperVGeneration": null,
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/resourceGroups/vm3_group/providers/Microsoft.Compute/disks/datadisk1",
"location": "westus2",
"managedBy": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/resourceGroups/vm3_group/providers/Microsoft.Compute/virtualMachines/vm3",
"managedByExtended": null,
"maxShares": null,
"name": "datadisk1",
"networkAccessPolicy": "AllowAll",
"osType": null,
"propertyUpdatesInProgress": null,
"provisioningState": "Succeeded",
"publicNetworkAccess": "Enabled",
"purchasePlan": null,
"resourceGroup": "vm3_group",
"securityProfile": null,
"shareInfo": null,
"sku": {
"name": "Premium_LRS",
"tier": "Premium"
},
"supportedCapabilities": null,
"supportsHibernation": null,
"tags": null,
"tier": "P15",
"timeCreated": "2022-07-22T15:43:11.477865+00:00",
"type": "Microsoft.Compute/disks",
"uniqueId": "b114cbb2-4b14-4946-9cf6-3881c4742615",
"zones": [
"1"
]
}
結果が表示されるとともにディスクマネージャーでもサイズが変更されたことを確認できます。

ポータルからはも変更できます。

まとめ
ダウンタイムなしにディスクのサイズが変更できるのはすごく便利だと思います。ただし、OSディスクで行えないことは非常に不便ですね。AWSではお行えます。
Azureの場合には一度、仮想マシンを停止することが必要ですが行えます。早くOSディスクでも行えるようになると良いですね。
