通过ARM模板在资源组上应用标记 [英] Applying Tagging on a Resource Group through ARM Template

查看:62
本文介绍了通过ARM模板在资源组上应用标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我正在尝试在我的所有Azure infra组件上应用标记。我们成功地在除资源组之外的所有组件上应用了标记,因为我找到了任何选项来执行此操作。因此,当我的同事应用了一些标记策略时,我无法从我的visual studio重新部署
与VM相关的任何ARM模板。我得出结论,因为我们最初在资源组上应用任何标记,并且在应用标记策略之后,它不允许重新部署任何内容,因为我们不满足在资源组上应用了标记的
的条件。 / p>

我们可以从arm模板为资源组应用标记吗?我们也有替代PowerShell。

解决方案

 


是的,你可以使用ARM模板部署带有标签的资源组。 


查看此处:  https://docs.microsoft.com/en-us/azure/templates/microsoft.resources/2018-05-01/resourcegroups


示例(抱歉格式):

















































" 资源" :[


{


" 类型"
" Microsoft.Resources / resourceGroups "


" apiVersion "
" 2018-05-01 "


" location "
" [parameters('rgLocation')] "


" name "
" [parameters('rgName')] "


" 标签" :{


" Tag "
" Value "


},


" 属性" :{}


},



G
运气好!


Hi Everyone,

I am trying to applying tagging on all my Azure infra components. We successfully applied tagging on all the components except resource group as i dint find any option to do so. So when my colleague applied some tagging policies i am not able to redeploy any ARM template related to a VM from my visual studio. I came to a conclusion that as we dint apply any tags on resource groups initially and after applying tagging policies it is not allowing to redeploy any thing as we are not satisfying the condition of having tagging applied on a resource group.

Can we apply tagging for a resource group from arm template? We have alternative as powershell as well.

解决方案

Hi, 

Yes you can deploy resource groups with tags using ARM templates. 

Take a look here: https://docs.microsoft.com/en-us/azure/templates/microsoft.resources/2018-05-01/resourcegroups

Example (Sorry for format):

"resources": [
{
"type": "Microsoft.Resources/resourceGroups",
"apiVersion": "2018-05-01",
"location": "[parameters('rgLocation')]",
"name": "[parameters('rgName')]",
"tags": {
"Tag": "Value"
},
"properties": {}
},


G
ood luck!


这篇关于通过ARM模板在资源组上应用标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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