PowerShell 命令:
New-AzResourceGroupDeployment -Name 'StAccDeployment' -TemplateFile '.\CreateStorageAccount.bicep' -ResourceGroupName 'bicepworks' -Mode Incremental
创建StorageAccount.bicep:
resource storageAccount 'Microsoft.Storage/storageAccounts@2023-05-01' = {
name: 'rajstaccprc01'
location: 'centralindia'
sku: {
name: 'Standard_LRS'
}
kind: 'BlobStorage'
}
上面的二头肌模板是一个基本模板。当我看到一些 udemy 课程视频时,导师使用上述基本模板成功配置了存储帐户。
我知道这个视频是很久以前的。那么,我是否错过了上面二头肌代码中的任何参数。
纠正我遗漏代码的地方:
错误详情:
New-AzResourceGroupDeployment: 15:25:52 - Error: Code=InvalidTemplateDeployment; Message=The template deployment 'StAccDeployment' is not valid according to the validation procedure. The tracking id is 'fb97bd7c-328a5a3c995b'. See inner errors for details.
New-AzResourceGroupDeployment: 15:25:52 - Error: Code=PreflightValidationCheckFailed; Message=Preflight validation failed. Please refer to the details for the specific errors.
New-AzResourceGroupDeployment: 15:25:52 - Error: Code=MissingRequiredAccountProperty; Message=Account property accessTier is required for the request.
New-AzResourceGroupDeployment: The deployment validation failed
错误消息说明了一切
代码=MissingRequiredAccountProperty; Message=账户属性 accessTier 为必填项
还有 Microsoft.Storage storageAccounts 2023-05-01 状态
的相关 MS 文档accessTier:对于 kind = BlobStorage 的存储帐户是必需的。
有效值如下。您可以在blob 数据的访问层文档页面
上阅读并选择适当的层- Cold
- Cool
- Hot
- Premium
所以添加这样的东西就可以了
properties: {
accessTier: 'Hot'
}