0

I am able to create a new virtual machine that's of a larger size than my current one, but I am not able to upgrade or resize an old VM to that larger size even though it's of a pretty similar type. So I'm thinking, since I can't resize the VM in place, can I create a new VM of the larger size and simply restore onto its OS disk the contents of the old, smaller VM's OS disk? I mean, the two VMs seem to be practically the same except the larger type features Premium Disk support.

I've resized other Azure VMs in place before easily, but this particular new scenario is a situation where the old VM I am trying to resize, E32a_v4, supports Standard SSD and the new one, E32as_v4, supports Premium SSD--which is the very reason I'm trying to upgrade! I mean, the two VM types are only off by one letter (s)! However, the resize operation is unfortunately not as straightforward. Azure will not allow the resize to be performed in place, saying, "Failed to resize virtual machine". Here are the details:

"Failed to resize virtual machine 'MyVirtualMachineName' to size 'Standard E32as_v4'. Error: Operation could not be completed as it results in exceeding approved standardEASv4Family Cores quota. Additional details - Deployment Model: Resource Manager, Location: eastus, Current Limit: 32, Current Usage: 32, Additional Required: 32, (Minimum) New Limit Required: 64. Submit a request for Quota increase at https://aka.ms/ProdportalCRP/?#create/Microsoft.Support/Parameters/bla-bla-bla by specifying parameters listed in the ‘Details’ section for deployment to succeed. Please read more about quota limits at https://docs.microsoft.com/en-us/azure/azure-supportability/per-vm-quota-requests."

But according to the Azure support technicians I'm interfacing with,

". . . If the customer is trying to resize a VM that operates on standard disk to a VM that operates on Premium disk, they will be unable to as there are significant hardware differences. However, the customer should be able to create a brand new VM as E32asv4 and migrate the data if they would like."

This is unacceptable, as creating a brand new VM for me wouldn't mean that I could simply "migrate the data"--there are a very many software packages configured and far too many other Windows policies and other settings I would have to recreate. It would be a very laborious task and the chances I will miss many important preferences and configurations is too high.

Thus I am thinking, can't I simply take a backup of the old E32a_v4 VM's OS disk and restore it onto the newly created E32as_v4 VM as its new OS disk (wiping out or replacing whatever it already had)?

  • PS: I am dealing with the Azure techies to further reconcile their answer against the error message I'm seeing in Azure--because it seems as though my resize operation ought to be possible if they'd only increase my quota! However, regardless of that outcome, my question still stands. I want to confirm whether an Azure VM's OS disk can be replaced with another's--and how. – ShieldOfSalvation Feb 01 '20 at 19:19

2 Answers2

1

Couple of things;

  • As you said error is strictly quota issue, so raising you quota increase will resolve that issue.
  • Assuming we are talking about managed disks. If you are have premium disk you cannot resize to a VM size that doesn't support premium disk, but if it is a standard disk you can resize to any VM size.
  • Yes there is an OS Swap option but you shouldn't need it because you can convert the disk then resize.
Hannel
  • 651
  • 4
  • 9
  • Saw the hassle on previous answer, you know you can switch this from the portal? https://i.imgur.com/P6ksSB7.png – Hannel Feb 03 '20 at 17:46
  • I knew that, but because the Azure techies were saying I had to create a new VM and migrate the data, I was frantically looking for a way to do so with minimal difficulty by just migrating the OS disk entirely if possible...which led up to the PowerShell answer above which in fact is unnecessary because I could have simply removed the extra new VM and resized the old one right via the web and that alone would have overcome the Azure quota error message I was getting. – ShieldOfSalvation Feb 03 '20 at 19:58
  • We only arrived at that conclusion with @Jamstrom via the ensuing comments. I submitted an edit to his answer to refine it and summarize it. – ShieldOfSalvation Feb 03 '20 at 20:04
0

looking at this link

This example shows how to convert all of a VM's disks from Standard to Premium storage or from Premium to Standard storage. To use Premium managed disks, your VM must use a VM size that supports Premium storage. This example also switches to a size that supports Premium storage.

#resource group that contains the virtual machine
rgName='yourResourceGroup'

#Name of the virtual machine
vmName='yourVM'

#Premium capable size 
#Required only if converting from Standard to Premium
size='Standard_DS2_v2'

#Choose between Standard_LRS and Premium_LRS based on your scenario
sku='Premium_LRS'

#Deallocate the VM before changing the size of the VM
az vm deallocate --name $vmName --resource-group $rgName

#Change the VM size to a size that supports Premium storage 
#Skip this step if converting storage from Premium to Standard
az vm resize --resource-group $rgName --name $vmName --size $size

#Update the SKU of all the data disks 
az vm show -n $vmName -g $rgName --query storageProfile.dataDisks[*].managedDisk -o tsv \
| awk -v sku=$sku '{system("az disk update --sku "sku" --ids "$1)}'

#Update the SKU of the OS disk
az vm show -n $vmName -g $rgName --query storageProfile.osDisk.managedDisk -o tsv \
| awk -v sku=$sku '{system("az disk update --sku "sku" --ids "$1)}'

az vm start --name $vmName --resource-group $rgName

Regarding your other error:

"Failed to resize virtual machine 'MyVirtualMachineName' to size 'Standard E32as_v4'. Error: Operation could not be completed as it results in exceeding approved standardEASv4Family Cores quota

You have hit a soft quota, number of vcores deployed in the VM size/sku E32as_v4. You got two options to resolve it:

  1. Delete VM’s in the same VM size/sku which will free up vcores
  2. Submit a ticket to Microsoft specifying that you want to raise the quota. This is an automatic process on Microsoft’s end and only take a few minutes
Jarnstrom
  • 705
  • 4
  • 9
  • PS C:\WINDOWS\system32> az vm resize --resource-group $rgName --name $vmName --size $size az : ERROR: The requested VM size Standard E32as_v4 is not available in the current region. The sizes available in the current region are: Standard_B1ls,Standard_B1ms, etc.... At line:3 char:1 + az vm resize --resource-group $rgName --name $vmName --size $size + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (ERROR: The requ...dard_ND40rs_v2.:String) [], Remote Exception + FullyQualifiedErrorId : NativeCommandError – ShieldOfSalvation Feb 03 '20 at 07:18
  • So the specified VM size/SKU that doesn’t seems to be available in your region, try one of the sizes that the error message print out – Jarnstrom Feb 03 '20 at 07:33
  • Well, I was able to create a new VM of the type I want so it must be available....! – ShieldOfSalvation Feb 03 '20 at 07:34
  • Ah, that’s weird. Maybe you can try one of the sizes in the error message as a troubleshooting step – Jarnstrom Feb 03 '20 at 07:35
  • Wait a minute....the right size was indeed there, just spelled with an underscore I had missed. Now I get this: az : ERROR: Operation could not be completed as it results in exceeding approved standardEASv4Family Cores quota. Additional details - Deployment Model: Resource Manager, Location: eastus, Current Limit: 32, Current Usage: 32, Additional Required: 32, (Minimum) New Limit Required: 64. Submit a request for Quota increase . . . – ShieldOfSalvation Feb 03 '20 at 07:40
  • So that’s the soft vcore/cpu quota which is tied to specific VM sizes. All you have to do is to open a ticket in the portal and choose quota. It’s an automated process that will raise your quota. Or if you have deployed a test server in the same VM size that you can remove. – Jarnstrom Feb 03 '20 at 08:15
  • That hadn't crossed my mind: the test VM I created earlier was sucking up some of my quota. I deleted it and the resize command worked! However, now I have other issues: az vm show -n $vmName -g $rgName --query storageProfile.dataDisks[*].managedDisk -o tsv \ | awk -v sku=$sku '{system("az disk update --sku "sku" --ids "$1)}' At line:2 char:1 + | awk -v sku=$sku '{system("az disk update --sku "sku" --ids "$1)}' + ~ An empty pipe element is not allowed. + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : EmptyPipeElement – ShieldOfSalvation Feb 03 '20 at 08:28
  • Removed the backslash but still: awk : The term 'awk' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:2 char:91 + ... --query storageProfile.dataDisks[*].managedDisk -o tsv | awk -v sku= ... + ~~~ + CategoryInfo : ObjectNotFound: (awk:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException – ShieldOfSalvation Feb 03 '20 at 08:30
  • I'll need a PS awk equivalent....researching that right now. – ShieldOfSalvation Feb 03 '20 at 08:39
  • To cut this short, although there are PowerShell means to mimic AWK, I decided to execute your last three lines of PowerShell code on the web GUI instead...basically, I went to my VM's Disks tab, selected the OS disk, and using the drop-down menu switched it from Standard SSD to Premium SSD because now that it's been converted to E32as_v4 type that's now possible! Yes! Then I just started the VM, again from the Azure portal GUI! It's up and running, baby, on Premium SSD with my desired E32as_v4 configuration! Thank you! I'll go back to your code and just add a few lines I ran prior to yours. – ShieldOfSalvation Feb 03 '20 at 08:54
  • Glad that it worked out for you! – Jarnstrom Feb 03 '20 at 13:29
  • Would you mind resubmitting your answer with the above in mind? It should simply state something to the effect, "if you have deployed a test server in the same VM size that you can remove, that will release the cores quota you need in order to continue your VM resize operation." I will feel better about marking that down as the answer in order to give you the deserved credit. I'm also thinking I might rewrite the original question title in order to draw attention to that. – ShieldOfSalvation Feb 06 '20 at 18:52
  • 1
    @ShieldOfSalvation done, edited my answer so check it out – Jarnstrom Feb 06 '20 at 20:40