问题
Need to assign a policy in Azure, where the resources are to be deployed only using the specified tag names and values. We need to add a Tag name for which there can be multiple Tag values depending upon the scenario.
For Example,
Tag Name: Environment
Tag Value: Prod, Non-Prod, UAT, Test
So, here the Tag Name is same for all the values, and the values will change accordingly for different scenarios. What could be the code for the same?
回答1:
You can user Azure Policy Framework and there is built-in definition for your requirement- "Enforces existence of a tag. Does not apply to resource groups."
Steps to create assignment from portal is specified here. This will not allow creation of resources without tag. You can checkout more in built definitions from Azure Portal
来源:https://stackoverflow.com/questions/56629219/azure-policy-to-add-tag-values-for-single-tag-name