Azure 预算 ARM 模板部署未经授权

标签 azure command-line-interface azure-rm-template unauthorized

我正在尝试部署包含 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/

相关文章:

shell - 如何在 ARM 模板部署期间在 shell 脚本中隐藏密码

Azure ARM 模板不同的资源组

azure devops 管道 CopyFiles@2 任务从代理 A 复制文件,但 DownloadBuildArtifacts@0 将文件下载到代理 B

git - 有没有办法为 git add --interactive 模式着色?

python - 在 macOS Sierra 中,如何配置 AWS CLI 以使用 Python3.x 而不是操作系统默认的 Python2.7?

java - 如何从命令行查询正在运行的java应用程序?

azure - 缩小 Azure 应用服务规模是否会导致服务器重新启动?

iis - 如何检索部署 azure 网站的 iis 服务器的名称

azure - 从图表编辑现有条件访问策略

azure - 如何使用 Bicep 激活 Azure Front Door 路线的压缩?