You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current method of updating the disk:
$diskUpdateConfig = New-AzDiskUpdateConfig -AccountType $storageType -DiskSizeGB $disk.DiskSizeGB
Update-AzDisk -DiskUpdate $diskUpdateConfig -ResourceGroupName $rgName `
-DiskName $disk.Name
Will cause loss of properties on the disk (ie. tags). Update-AzDisk does not get all of the original properties of the current disk, and it is a PUT operation, which means it is just doing a PUT of whatever is specified in the New-AzDiskUpdateConfig result, which means anything not specified in the request will be lost (ie. tags are removed).
This method will just update the properties that you are trying to change and preserve everything else:
$disk.Sku = [Microsoft.Azure.Management.Compute.Models.DiskSku]::new($storageType)
$disk | Update-AzDisk
0 commit comments