我正在尝试在西欧创建一个带有二头肌的存储帐户。
我收到以下错误:
{"code": "InvalidTemplateDeployment", "message": "The template deployment 'bicep-deployment-from-ground-up' is not valid according to the validation procedure. The tracking id is '1a94c0f3-1bf2-4b71-8f03-0a2689129899'. See inner errors for details."}
Inner Errors:
{"code": "PreflightValidationCheckFailed", "message": "Preflight validation failed. Please refer to the details for the specific errors."}
Inner Errors:
{"code": "InvalidValuesForRequestParameters", "target": "dtcontent", "message": "Values for request parameters are invalid: kind, sku. For more information, see - https://aka.ms/storageaccounttypes"}
Inner Errors:
{"code": "InvalidValuesForRequestParameters", "target": "dtcontent", "message": "Values for request parameters are invalid: kind."}
二头肌看起来像这样:
param location string = resourceGroup().location
resource dtcontent 'Microsoft.Storage/storageAccounts@2023-01-01' = {
name: 'dtcontent'
location: location
kind: 'BlockBlobStorage'
sku: {
name: 'Premium_LRS'
}
properties: {
minimumTlsVersion: 'TLS1_2'
publicNetworkAccess: 'Enabled'
allowBlobPublicAccess: true
accessTier: 'Hot'
}
resource blobService 'blobServices@2023-01-01' = {
name: 'default'
resource content 'containers@2023-01-01' = {
name: 'content'
properties: {
publicAccess: 'Container'
}
}
}
}
我使用的是 az cli 2.57.0 和 bicep 版本 0.25.53。现在有人如何修复这个错误吗?
在我的环境中,我使用的是
az cli
版本 2.56.0 和 bicep
版本 0.25.53。
根据此 MS-Document,
Premium
访问层是高级块 Blob 存储帐户类型的默认值,并且无法针对高级块 Blob 存储帐户类型进行更改。
您不需要在二头肌代码中传递
access tier
,并确保您的部署资源组位于同一位置。
在我的环境中,我尝试使用以下脚本使用
westeurope
位置。
代码:
param location string = resourceGroup().location
resource dtcontent 'Microsoft.Storage/storageAccounts@2023-01-01' = {
name: 'dtcontent2'
location: location
kind: 'BlockBlobStorage'
sku: {
name: 'Premium_LRS'
}
properties: {
minimumTlsVersion: 'TLS1_2'
publicNetworkAccess: 'Enabled'
allowBlobPublicAccess: true
}
resource blobService 'blobServices@2023-01-01' = {
name: 'default'
resource content 'containers@2023-01-01' = {
name: 'content'
properties: {
publicAccess: 'Container'
}
}
}
}
部署命令:
az deployment group create --resource-group v-venkat --template-file ./sample.bicep
此处,
v-venkat
是一个资源组,其位置为 westeurope
。
输出:
传送门:
参考:
Microsoft.Storage/storageAccounts - Bicep、ARM 模板和 Terraform AzAPI 参考 |微软学习