Troubleshoot Azure VM Deployment Failures.
Perhaps the most common two failures you may see
occasionally with Azure VMs happen, first, when you're
attempting to either create, restart,
resize or perform some platform‑level change with your Azure VMs. For example,
you might occasionally encounter allocation failed errors.
What this normally points to is a capacity issue on Microsoft's side, and it's a
reminder for us as hybrid cloud administrators that because we're never going to
get within miles or kilometers of the Microsoft.
Azure data centers,
it's particularly important to be aware of the visibility that Microsoft
does give. And here, the main pointer I want you to think of are tools
like Azure Monitor activity log and also the resource health tool where
you can get validation that yes,
in fact, Microsoft may be having issues in that region and that data
center. And I found in my experience that trying or retrying the operation
after a pause can generally work past those issues.
Another type of area you might see with creating, restarting,
resizing Azure VMs is a provisioning failure.
Now, this normally points to things like you're trying to do something that's
just simply not supported. Maybe you're attempting to deploy an Azure VM and
specifying a size that's not available in that region.
This points to the fact that not every Azure
service is available in every region.
Some are,
but many are not, and that definitely goes for
Azure virtual machine image sizes.
This points to your being tied in deeply to the Microsoft Azure docs
and verifying that, in fact, your services are available in those
regions. Remember that if worse comes to worst,
you can file a support ticket with Microsoft Azure support.
All right, so that's one VM deployment failure category.
Another would be a validation issue with your deployment template.
You could be using Azure Resource Manager JSON templates or
Bicep templates. I've found, again, in my experience, 8 times
out of 10 it's a syntax error,
particularly with the JSON. Maybe you've missed a comma or a
closing curly brace or square bracket.
You also may have something simple like an invalid parameter.
Maybe you're using an allowedValues array. For example,
maybe you have for the location property of a deployment, you've got a
parameter for location, and you've created an allowedValues array that
restricts you to only say East US and East US2. One of your colleagues
attempts to deploy the template by providing, say, West US for a
location parameter value.
Well, that certainly is going to bomb out the deployment.
So, there's that. Lastly, there's circular dependencies. Fortunately, Bicep
handles dependencies much more gracefully in my opinion than does ARM. In ARM
JSON, you have that DependsOn property, but if you're not careful, depending
upon how complex your deployment template is, you could create a circular
loop where you've got a dependency on a resource, which in turn has a
dependency on the first resource, and they just get caught in a terrible
situation there.
So, actually, I think all three of these deal with human error and
speak to factoring and refactoring your templates,
debugging your templates, inviting your colleagues in for code reviews.
And the good news is once you've resolved those, the template should then work in perpetuity going forward.