Bicep diagnostic code - BCP073

This diagnostic occurs when you assign a value to a read-only property.

Description

The property <property-name> is read-only. Expressions cannot be assigned to read-only properties.

Level

Warning / Error

Solution

Remove the property assignment from the file.

Examples

The following example raises the diagnostic because sku can only be set on the storageAccounts level. It's read-only for services that are under a storage account like blobServices and fileServices.

param location string

resource storage 'Microsoft.Storage/storageAccounts@2023-04-01' = {
  name: 'mystore'
  location: location
  sku: {
    name: 'Standard_LRS'
  }
  kind:  'StorageV2'
}

resource blobService 'Microsoft.Storage/storageAccounts/blobServices@2023-04-01' = {
  parent: storage
  name: 'default'
  sku: {}
}

You can fix the issue by removing the sku property assignment:

param location string

resource storage 'Microsoft.Storage/storageAccounts@2023-04-01' = {
  name: 'mystore'
  location: location
  sku: {
    name: 'Standard_LRS'
  }
  kind:  'StorageV2'
}

resource blobService 'Microsoft.Storage/storageAccounts/blobServices@2023-04-01' = {
  parent: storage
  name: 'default'
}

Next steps

For more information about Bicep diagnostics, see Bicep core diagnostics.