skip to Main Content

PowerShell Command:

New-AzResourceGroupDeployment -Name 'StAccDeployment' -TemplateFile '.CreateStorageAccount.bicep' -ResourceGroupName 'bicepworks' -Mode Incremental

CreateStorageAccount.bicep:

resource storageAccount 'Microsoft.Storage/storageAccounts@2023-05-01' = {
  name: 'rajstaccprc01'
  location: 'centralindia'
  sku: {
    name: 'Standard_LRS'
  }
  kind: 'BlobStorage'
}

The above bicep template is a basic one. When I see some udemy course video, the tutor succeeded the provisioning of the storage account using above basic template.

I know the video is from long ago. So, Do I miss any parameters in the above bicep code.

Correct me where I missed the code:

Error details:

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

2

Answers


  1. The error message says it all

    Code=MissingRequiredAccountProperty; Message=Account property accessTier is required

    Also the relevant MS docs for Microsoft.Storage storageAccounts 2023-05-01 state

    accessTier: Required for storage accounts where kind = BlobStorage.

    Valid values are below. You can read about & choose the appropriate tier on the Access tiers for blob data docs page

    - Cold
    - Cool
    - Hot
    - Premium
    

    So adding something like this should do it

    properties: {
        accessTier: 'Hot'
    }
    
    Login or Signup to reply.
  2. As @jitter answered, if using kind = BlobStorage, the accessTier in properties is required. reference

    resource storageAccount1 'Microsoft.Storage/storageAccounts@2023-05-01' = {
      name: 'satest111'
      location: 'westus'
      sku: {
        name: 'Standard_LRS'
      }
      kind: 'BlobStorage'
      properties: {
        accessTier: 'Cold'
      }
    }
    
    

    enter image description here

    Try to use kind = 'StorageV2' to make it easy if the kind not mandatory, v2 type is also recommanded.

    resource storageAccount2 'Microsoft.Storage/storageAccounts@2023-05-01' = {
      name: 'satest222'
      location: 'westus'
      sku: {
        name: 'Standard_LRS'
      }
      kind: 'StorageV2'
    }
    

    here is a sample reference

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search