Azure策略为单个标签名称添加标签值 [英] Azure Policy to add tag values for single tag name

查看:184
本文介绍了Azure策略为单个标签名称添加标签值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要在Azure中分配策略,在该策略中仅使用指定的标记名称和值来部署资源. 我们需要添加一个Tag名称,根据情况,该名称可以有多个Tag值.

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.

例如

标记名称:环境

标签值:产品,非产品,UAT,测试

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?

推荐答案

您可以使用框架,并且为您的要求提供了内置定义:强制存在标签.不适用于资源组."

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."

在门户网站上指定从门户创建分配的步骤此处. 这将不允许创建没有标签的资源. 您可以从Azure门户中查看更多内置定义的信息

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

这篇关于Azure策略为单个标签名称添加标签值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆