我正在尝试部署包含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"
}
}
答案 0 :(得分:0)
我遇到了完全相同的问题,最终是过滤器,如果过滤器设置不正确,那么预算会尝试应用到您的订阅中,而不仅是资源组或您定位的目标是
{
"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')" ]
}
}
}
}
答案 1 :(得分:0)
我有同样的错误信息。解决方案是使用Action Group
的完整ID,而不仅仅是名称。
ARM模板的通知部分的示例:
"notifications": {
"Notification1": {
"enabled": true,
...
"contactGroups": [
"/subscriptions/xxx/resourceGroups/rg-name/providers/microsoft.insights/actionGroups/ag-name"
]
}
}