我正在尝试部署包含 Azure 预算的 ARM 模板。目前我正在使用 Azure CLI,但也可以通过门户进行。
az deployment group create --resource-group my-rg --template-file c:\dev\arm_template.json
我想知道避免以下错误的解决方案:
Deployment failed. Correlation ID: 10cfac68-3ce9-4527-bee8-df48a761f965. {
"error": {
"code": "401",
"message": "Unauthorized. Request ID: 4c5ee5cb-4b71-4c8b-8965-f3b89cdd2c8a"
}
}
最佳答案
我遇到了完全相同的问题,最终成为过滤器,如果过滤器设置不正确,那么预算会尝试应用于您的订阅,而不仅仅是资源组或您所定位的任何内容
{
"name": "[variables('budgetName')]",
"type": "Microsoft.Consumption/budgets",
"apiVersion": "2019-10-01",
"properties": {
"timePeriod": {
"startDate": "2020-09-01T00:00:00Z",
"endDate": "2028-07-01T00:00:00Z"
},
"timeGrain": "Monthly",
"amount": 40,
"currentSpend": null,
"category": "Cost",
"notifications": {
"GreaterThan80": {
"enabled": true,
"operator": "GreaterThan",
"threshold": 80,
"contactEmails": [],
"contactRoles": [],
"contactGroups": [
"[resourceId('Microsoft.Insights/actionGroups',variables('actionGroupName'))]"
]
}
},
"filter": {
"dimensions": {
"name": "ResourceGroupName",
"operator": "In",
"values": [ "variables('resourceGroup')" ]
}
}
}
}
关于Azure 预算 ARM 模板部署未经授权,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63557553/