Microsoft Azure is one of the world’s most popular cloud computing platforms. It is a preferred platform for a lot of enterprises as it helps them achieve their goals with freedom and flexibility to build, manage, and deploy their applications anywhere, anytime. But if you are someone who has worked with Microsoft Azure for a bit or have just started or are somebody who aspires to work with Microsoft Azure, then you would know encountering errors is part and parcel of the job. We try to do our best at all times, but errors can still happen, and so far as they get noticed & tackled early on, things can be remedied without any major damage.
This blog shares some simple deployment errors you might encounter while working with Microsoft Azure and how to troubleshoot them.
What are Deployment Errors?
As a professional working with Microsoft Azure – a developer, an administrator, an engineer, etc. would usually encounter two main types of errors –
- Validation errors
- Deployment errors
Validation errors are the errors that you will encounter before you enter the deployment phase. Validation errors can be troubleshot without having any interaction with the current Azure environment. Common examples of validation errors include syntax errors and missing arguments for a function.
The other kind of error is deployment errors. The deployment errors could only be discovered by attempting the deployment and interaction with the Microsoft Azure environment. A simple example of a deployment error would be needing your virtual machine’s Network Interface Card (NIC). If the NIC is absent when the virtual machine gets deployed, you will encounter a deployment error.
Always remember – Microsoft Azure resources can be deployed either with Bicep files or with the Azure Resource Manager templates, commonly called the ARM templates. Let us go over some common Azure deployment errors:
Common Azure Deployment Errors
Error: Storage Account Name Invalid
When you have an invalid storage account name, you will encounter an error during deployment.
Suppose your account name has prohibited characters like say an uppercase character or a special character, your account name would be invalid. In this case, you would need to change the name and use only the permitted characters.
The other way you encounter the storage name error would be if you are attempting to deploy a new storage account that has the same name and is in the same resource group, but your location is different on Azure. To resolve this, you would need to choose a different name to resolve the error and create the storage account.
Another reason one encounters is if your storage account already exists in another resource group. This happens when one deploys a new storage account with the same name and the same location as an existing storage account, however, you do that in a different resource group on Azure. The simple solution to this would be to change the name and/or location.
One more error that is encountered in this error group is when the storage account is already taken. This happens when one tries to deploy a new storage account with a name that is the same as an existing storage account.
As a thumb rule, always remember that storage account names need to be globally unique across all of your Azure. Keep this in mind when assigning storage names or changing storage names and you will significantly reduce how many times you encounter these deployment errors.
Error: Deployment Quota Exceeded
As a rule, in Microsoft Azure, every resource group would be limited to 800 deployments through the course of its deployment. A deployment quota exceeded error is encountered when one exceeds these 800 deployments limit. The simplest way to resolve this error would be to delete the deployments from the resource group history and try again. Also, rest assured, that when you delete a deployment from a resource group history, it will not affect the other resources that have been deployed.
It is also important to remember that the Azure Resource Manager automatically deletes the deployments from the history as the user reaches closer to the deployment limit of 800. This ensures that you usually don’t encounter the deployment quota exceeded error. However, even after that, you could still encounter this deployment error. There are three main reasons this could be happening:
- You could be having an active CanNotDelete lock on a resource group which could block the Azure Resource Manager from deleting the deployment history
- You could have turned out the auto-delete feature in the Azure Resource Manager
- You could be having a relatively large number of deployments running simultaneously so the Azure Resource Manager may not be able to keep up with its automatic deletions to keep the total number below the limit
Error: Invalid Template
An invalid template error could occur for a host of reasons from syntax errors to invalid parameter values or even a circular dependency. The invalid template error occurs when there is a syntax or a structural error in the template. Once you identify the issue causing the error, you can easily resolve it and eliminate the error.
In case your invalid template error is a result of a syntax error then the error message you receive will indicate a template failed validation. A template expression usually has multiple elements. For instance, take the case of name assignment for storage accounts. This would comprise a pair of single or double quotes, curly brackets, square brackets, and parenthesis. That is a lot of elements. Additionally, expressions could also include functions and special characters such as commas, dollar signs, dots, etc. To resolve a syntax error, one needs to review the expression’s syntax first.
Another reason one could encounter an invalid template error is because of incorrect segment length. This happens when the resource name is not in the correct format. One needs to engage in some troubleshooting for resolving name and type mismatch errors.
If the parameters are not valid, then also one could encounter an invalid template error. This happens when during deployment, a value is provided that is not valid. When an invalid template error is encountered, for this reason, one must check for the parameter’s allowed values and then use values that are permitted during deployments.
A circular dependency could also be a problem causing an invalid template error. When resources are dependent on each other in a way that prevents a deployment from triggering, it causes an invalid template error. When there is a combination of interdependencies, the resource has to wait for other resources, which also could be waiting in the queue. The simplest solution to this error is to remove unnecessary dependencies. Once the resource is identified that is causing the circular dependency, one can examine the dependsOn property and applications of the reference function to identify the dependencies for those resources. Those resources can be further examined to identify the resources they depend on. Any dependencies that are not required must be removed. Once the unnecessary dependencies are removed, the template should be redeployed.
Error: Job Size Exceeded
This type of deployment error includes two common errors:
This error, as the name suggests, indicates that the deployment has exceeded limits. This would happen when the template or the job that is being deployed is too large. As a thumb rule, always remember that a deployment job should not exceed 1 MB, including the metadata for the request. For a template, the size limit is 4 MB at the final stage of the template after expanding the same for resource definitions using loops for generating multiple instances. A template should also be limited to 256 parameters, 256 variables, 800 resources, 64 output values, and 24,576 characters in the expression.
The solutions for this type of deployment error include using dependencies carefully, simplifying the template by setting other resources as implicit dependencies or dividing resource types into logical groups, shortening the length of names being used, etc.
Error: Parent Resource Not Found
This deployment error is encountered when a resource dependent on a parent resource gets deployed. For a child resource to function smoothly, the parent resource has to exist appropriately before the child resource gets created. The name of the child resource also has to be assigned in a specific format. Now, if a server and a database are employed in the same template without the server dependency being specified, then the database deployment could get triggered before the server gets deployed, resulting in a parent resource not found error. The same could also happen when a parent resource is already in existence but is not deployed in the same template, since the Azure Resource Manager cannot connect the child resource to the parent resource. Another reason this happens is when the child resource is not in the correct format or it is deployed to a resource group that is not the same as the resource group for the parent resource.
Solutions for this type of error include setting a dependency when the parent and child resources are deployed in the same template and not setting a dependency when the parent and the child resources are being deployed in different templates.
Error: Request Disallowed by Policy
When triggering a deployment, one could encounter a RequestDisallowedByPolicy error which would prevent the user from creating a resource. The Azure CLI, Azure PowerShell, and the Azure activity log would give the same information about the error. The key elements for this deployment error are the error code, policy assignment, and policy definition.
A RequestDisallowedByPolicy error would take place when an administrator tries to create a network interface with a public IP address. The policy assignment of a built-in policy definition would prevent the public IP from functioning on the network interfaces. To understand more about why this error occurred one would need to find out more about the policy that caused the error by using the policy name or the policy definition.
Azure administrators would ideally assign policies to maintain security and compliance. This would also limit the deployment of resources. Based on the error message received and the policy listed in the error, one can find out more about the policy and see if there is a workaround for this.
Error: Resource Quota Exceeded
A ResourceQuotaExceeded error occurs when one’s templates create resources that exceed their permitted Azure quotas. There are allocated quotas for every resource group, every subscription, every account, etc. Whenever a deployment exceeds these allocated quotas, the ResourceQuotaExceeded error will show up.
One easy solution to this error is to request a quota increase. One can go to the portal and request a quota increase by filing a support issue. Some quotas would let users specify a quota limit that can be submitted and then can be either accepted or rejected. In case the request is rejected, a support issue can be filed on the link that comes with the intimation.
One can either manage their resource requirements or can request additional limits to solve this error.
Error: SKU Not Available
This type of deployment error is commonly encountered when an SKU is not available in a specific azure subscription region or availability zone. It can also occur when commands like New-AzVM or az vm create that usually specify a size parameter for the SKU which can sometimes not be available. When one encounters this error, the Azure CLI and the Azure PowerShell deployment commands would show an error message that says that the requested size is not available for the region or zone. The corresponding error in the activity log on the Azure portal would be SkuNotAvailable or InvalidTemplateDeployment.
This error is usually a result of selecting a resource SKU like the VM size which is not available in the region or availability zone that it is being deployed in. It can also occur when one is trying to deploy an Azure Spot VM or a Spot Scale Set Instance but there is no capacity for the Azure spot in that region.
To resolve this error, one needs to first examine what is causing it. If the SKU is not available for a particular Azure subscription in the user’s location or availability zone but it is necessary for the business, then an SKU request can be submitted to Azure Support. One can go through the list of all the compute resources for any location’s availability zones on the Azure portal as well, based on which the deployment can be modified or Support requests are raised.
These are some of the commonly encountered deployment errors in Microsoft Azure ad how you can resolve them. There are many more kinds of deployment errors apart from these.
If you would like to learn more about Microsoft Azure and be a Microsoft Certified Azure Administrator, you need to clear the AZ-104: Microsoft Azure Administrator examination. To prepare for the examination, Cognixia – the world’s leading digital talent transformation company offers a thorough live online instructor-led hands-on Microsoft Azure training and certification course. Cognixia is a Microsoft Silver Partner and offers online Microsoft Azure training in line with the official Microsoft guideline and exam outline.
Cognixia’s AZ-104 training covers the five domains as recommended by Microsoft:
- Manage Azure identities and governance
- Implement and manage storage
- Deploy and manage Azure compute resources
- Configure and manage virtual networking
- Monitor and back-up Azure resources
To know more about Cognixia and the AZ-104: Microsoft Azure Administrator certification exam, talk to us today!