Migrating to managed Disks – “Operation is not allowed since VM has an extension in failed state.”

Get-AzVMExtension -ResourceGroupName "xxxxx" -VMName "xxxxxxxx" | Select-Object Name, ProvisioningState

IaaSDiagnostics was Failed

Trying to remove the errored Extension

Remove-AzVMExtension: Cannot modify extensions in the VM when the VM is not running.
ErrorCode: OperationNotAllowed
ErrorMessage: Cannot modify extensions in the VM when the VM is not running.

Stuck!

Go to the UnManaged Disk and get the VHD Location

Setup a new Managed Disk with the VHD per below

$diskConfig = New-AzDiskConfig `
  -AccountType StandardSSD_LRS `
  -Location "australiaeast" `
  -CreateOption Import `
  -SourceUri "https://xxxxxx.blob.core.windows.net/vhds/xxxxxx.vhd" `
  -StorageAccountId "/subscriptions/xxxxxx/resourceGroups/GSHRG/providers/Microsoft.Storage/storageAccounts/xxxxx" `
  -OsType Windows

New-AzDisk -ResourceGroupName "XXXXXXX" -DiskName "XXXXXXX-OSDisk-Managed" -Disk $diskConfig

Create a new VM with the managed disk

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...