尝试 az 部署时“提供的 resource.properties.tenantId 'null' 无效”

问题描述 投票:0回答:1

我正在尝试使用

测试部署
> az deployment sub what-if --location uksouth --template-file .\main.bicep --verbose

我收到以下错误消息,这不是很有用。

InvalidTemplateDeployment - 根据验证过程,模板部署“main”无效。跟踪 ID 为“xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx”。有关详细信息,请参阅内部错误。 BadRequest - 提供的resource.properties.tenantId“null”无效。

如何找出错误“提供的resource.properties.tenantId 'null'无效”指的是哪个资源?

此外,当使用

--debug
运行时,我看到以下错误:

...
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/arm.py", line 109, in handle_template_based_exception
AttributeError: 'InvalidTemplateError' object has no attribute 'inner_exception'
...

这看起来像是 Azure CLI 中的错误

azure-cli
1个回答
0
投票

我已调试*该问题,发现根本原因是我错过了 Azure B2C 目录中的一些

createTenantProperties

我有

resource b2cDirectory 'Microsoft.AzureActiveDirectory/b2cDirectories@2023-01-18-preview' = {
  name: 'foo.onmicrosoft.com'
  location: 'Europe'
  tags: {
    Environment: 'Prod'
  }
  sku: {
    name: 'PremiumP1'
    tier: 'A0'
  }
}

我需要

resource b2cDirectory 'Microsoft.AzureActiveDirectory/b2cDirectories@2023-01-18-preview' = {
  name: 'foo.onmicrosoft.com'
  location: 'Europe'
  tags: {
    Environment: 'Prod'
  }
  sku: {
    name: 'PremiumP1'
    tier: 'A0'
  }
  properties: {
    createTenantProperties: {
      countryCode: 'GB'
      displayName: 'Foo Foo Foo'
    }
  }
}

* 关于“调试”,我采用了经过验证的“将所有内容注释掉,然后一次注释掉一个内容,看看它在哪里损坏”的方法。确实,Azure CLI 中的错误消息传递需要改进

© www.soinside.com 2019 - 2024. All rights reserved.