Code=InvalidTemplate;
Message=Deployment template validation failed: 'The provided value {parameter value}
for the template parameter {parameter name} is not valid. The parameter value is not
part of the allowed values
Check the template for the parameter's allowed values, and use an allowed value during deployment. For more information, see allowed values for Bicep or ARM templates.
Solution 4: Too many target resource groups
You may see this error in earlier deployments because you were limited to five target resource groups in a single deployment. In May 2020, that limit was increased to 800 resource groups. For more information, see how to deploy to multiple resource groups for Bicep or ARM templates.
Solution 5: Circular dependency detected
You receive this error when resources depend on each other in a way that prevents the deployment from starting. A combination of interdependencies makes two or more resources wait for other resources that are also waiting. For example, resource1
depends on resource3
, resource2
depends on resource1
, and resource3
depends on resource2
. You can usually solve this problem by removing unnecessary dependencies.
Bicep creates an implicit dependency when one resource uses the symbolic name of another resource. An explicit dependency using dependsOn
usually isn't necessary. For more information, see Bicep dependencies.
To solve a circular dependency:
In your template, find the resource identified in the circular dependency.
For that resource, examine the dependsOn
property and any uses of the reference
or resourceId
functions to see which resources it depends on.
Examine those resources to see which resources they depend on. Follow the dependencies until you notice a resource that depends on the original resource.
For the resources involved in the circular dependency, carefully examine all uses of the dependsOn
property to identify any dependencies that aren't needed. To troubleshoot the deployment, remove the circular dependencies. Rather than delete the code, you can use comments so that the code doesn't run during the next deployment. You can use single-line comments (//
) or multi-line comments (/* ... */
) in ARM templates or Bicep files.
Redeploy the template.
Removing values from the dependsOn
property can cause errors when you deploy the template. If you get an error, add the dependency back into the template. If you used comments to bypass code in your template, you can remove the comments to restore the code.
If that approach doesn't solve the circular dependency, consider moving part of your deployment logic into child resources (such as extensions or configuration settings). Configure those child resources to deploy after the resources involved in the circular dependency. For example, suppose you're deploying two virtual machines but you must set properties on each one that refer to the other. You can deploy them in the following order:
Extension on vm1 depends on vm1 and vm2. The extension sets values on vm1 that it gets from vm2.
Extension on vm2 depends on vm1 and vm2. The extension sets values on vm2 that it gets from vm1.
The same approach works for App Service apps. Consider moving configuration values into a child resource of the app resource. You can deploy two web apps in the following order:
webapp1
webapp2
Configuration for webapp1 depends on webapp1 and webapp2. It contains app settings with values from webapp2.
Configuration for webapp2 depends on webapp1 and webapp2. It contains app settings with values from webapp1.
Solution 6: Validate syntax for exported templates
After you deploy resources in Azure, you can export the ARM template JSON and modify it for other deployments. You should validate the exported template for correct syntax before you use it to deploy resources.
You can export a template from the portal, Azure CLI, or Azure PowerShell. There are recommendations whether you exported the template from the resource or resource group, or from deployment history.
Bicep
After you export an ARM template, you can decompile the JSON template to Bicep. Then use best practices and the linter to validate your code.
For more information, go to the following articles:
Decompiling ARM template JSON to Bicep
Best practices for Bicep
Add linter settings in the Bicep config file
After you export an ARM template, you can learn more about best practices and the toolkit for template validation:
ARM template best practices
ARM template test toolkit
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see: https://aka.ms/ContentUserFeedback.
Submit and view feedback for
This product