azure - 无法使用 bicep 创建 azure b2c 租户

标签 azure azure-ad-b2c azure-bicep

我正在尝试使用 bicep 创建一个 azure 的 B2c 租户。当我在门户中执行此操作时,一切正常。有了 terraform 也一切都好。但有了二头肌我就明白了

New-AzSubscriptionDeployment : 5:41:21 PM - The deployment 'xpto-devTEST' failed with error(s). Showing 2 out of 2 error(s). Status Message: The response for resource had empty or invalid content. (Code:ResourceDeploymentFailure) Status Message: At least one resource deployment operation failed. Please list deployment operations for details. Please see

  • { "error": { "code": "ResourceDeploymentFailure", "message": "The response for resource had empty or invalid content." } } (Code:InternalServerError) CorrelationId: c0a20039-0a78-44c3-94fb-998c53c661a4 At line:1 char:1
  • New-AzSubscriptionDeployment -Name xpto-devTEST -Template ...
  • + CategoryInfo          : NotSpecified: (:) [New-AzDeployment], Exception
    + FullyQualifiedErrorId : >Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureSubscriptionDeploymentCmdlet
    

我的主要二头肌有这个

@description('the name of the environment. this must be dev, test, or prod.')
@allowed([
  'dev'
  'test'
  'prod'
])
param environmentname string = 'dev'

@description('the location of the resource')
param location string = 'northeurope'
@description('Name of the resource group')
param resourceGroupName string = 'xpto-${environmentname}'

targetScope = 'subscription'

resource rg 'microsoft.resources/resourcegroups@2021-04-01' = {
  name: resourceGroupName
  location:location
}

module azureb2c 'modules/azureB2C.bicep' = {
  name: 'xptoTenant-${environmentname}'
  scope: rg
}

我的模块有这个

@description('The name of the environment. This must be dev, test, or prod.')
@allowed([
  'dev'
  'test'
  'prod'
])
param environmentName string = 'dev'

@description('The location of the resource')
param location string = 'Europe'

resource b2c 'Microsoft.AzureActiveDirectory/b2cDirectories@2019-01-01-preview' ={
  name: 'xpto${environmentName}Tenant.onmicrosoft.com'
  location: location
  sku: {
    name: 'PremiumP1'
  }
  properties:{
    createTenantProperties:{
      displayName: 'xpto-${environmentName}-tenant'
      countryCode: 'PT'
    
    }
  }
}

我正在运行的命令是这个

New-AzSubscriptionDeployment -Name xpto-devTEST -TemplateFile main.bicep -TemplateParameterFile .\main.parameters-dev.json -DeploymentDebugLogLevel All

有人可以帮我吗?

最佳答案

resource b2cDirectory 'Microsoft.AzureActiveDirectory/b2cDirectories@2021-04-01' = {
  #disable-next-line no-hardcoded-location
  location: 'Australia'
  name: '<your-name>.onmicrosoft.com'
  sku: {
    name: 'PremiumP2'
    tier: 'A0'
  }
  properties: {
    createTenantProperties: {
      countryCode: 'AU'
      displayName: '<Your description>'
    }
  }
  tags: {
    Department: 'Dev'
  }
}

有效!名称可能很重要,您需要使用有效的 DNS 名称来命名您的资源。

关于azure - 无法使用 bicep 创建 azure b2c 租户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71178130/

相关文章:

azure - 在 Azure Pipelines 中用 FileTransform@1 替换变量时,可以采取哪些步骤来修复 InvalidRequestContent 错误?

azure - 如果安全参数中包含某个字符,则需要帮助停止二头肌部署

azure - 在 Azure 上,我可以在 ASE 中运行 Windows Docker 容器吗?

azure - 使用 Azure TimeSeries Insights 获取时间序列的最后值

azure - 使用 Active Directory 客户端库通过电子邮件地址查找用户

使用 AD B2C 进行守护程序应用程序的 Azure 函数身份验证

azure - 尝试修改存储帐户的角色分配时出现 Bicep 错误

azure - Microsoft Orleans - 如何激活不同筒仓中的 X 提醒颗粒?

c# - 如何在azure函数中的local.settings.json文件中设置数组值

azure-active-directory - 使用 Azure AD B2C 而不是 login.microsoftoneline.com 表单的编程(API 调用)用户身份验证