我正在使用 Powershell 从模板文件和参数文件创建 Azure 资源组。
New-AzureResourceGroup -Name $groupName `
-TemplateFile $templateFile `
-TemplateParameterFile $paramFile `
-Location $location `
-Force -Verbose
在模板中,我在组内的资源上设置一些标签。
resourcegroup.json
"parameters": {
"environment": {
"type": "string",
"allowedValues": [
"Dev",
"Test",
"QA",
"Prod"
]}
}
....
"resources": [
{
...
"tags": {
"Environment": "[parameters('environment')]",
}
}
我想将相同的标记值应用到资源组本身,但我没有在模板文件的架构中看到执行此操作的方法。我错过了什么吗?
最佳答案
至少现在,这是可能的:
{
"type": "Microsoft.Resources/tags",
"name": "default",
"apiVersion": "2020-06-01",
"dependsOn": [
"resource1"
],
"properties": {
"tags": {
"Tag1": "Value1",
"Tag2": "Value2"
}
}
}
文档引用 here
关于powershell - 将标签应用到资源模板文件中的 Azure 资源组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27994111/