我正在尝试使用 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/