| title | BCP036 |
|---|---|
| description | The property <property-name> expected a value of type <data-type> but the provided value is of type <data-type>. |
| ms.topic | reference |
| ms.custom | devx-track-bicep |
| ms.date | 12/05/2025 |
This diagnostic occurs when you assign a value to a property whose expected data type isn't compatible with the type of the assigned value.
The property <property-name> expected a value of type <data-type> but the provided value is of type <data-type>.
Warning / Error
Assign a value with the correct data type.
The following example raises the diagnostic because sku is defined as a string, not an integer:
type storageAccountConfigType = {
name: string
sku: string
}
param foo storageAccountConfigType = {
name: 'myStorage'
sku: 2
}You can fix the issue by assigning a string value to sku:
type storageAccountConfigType = {
name: string
sku: string
}
param foo storageAccountConfigType = {
name: 'myStorage'
sku: 'Standard_LRS'
}The following example raises the diagnostic because the accessPolicies property expects an array of single AccessPolicyEntry objects. The nested brackets [ ... ] inside the loop cause it to create an array of arrays.
param principalIds array = [
'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
'yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy'
]
resource keyVault 'Microsoft.KeyVault/vaults@2021-10-01' = {
name: 'my-kv-001'
location: resourceGroup().location
properties: {
tenantId: subscription().tenantId
sku: {
family: 'A'
name: 'standard'
}
accessPolicies: [
for principalId in principalIds: [ // <--- The extra array brackets here [ ]
{
objectId: principalId
tenantId: subscription().tenantId
permissions: {
secrets: ['Get', 'List']
}
}
]
]
}
}The fix is to remove the unnecessary array brackets ([]) from around the item being generated inside the loop. This will create an array of single AccessPolicyEntry objects, as expected by the accessPolicies property.
param principalIds array = [
'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
'yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy'
]
resource keyVault 'Microsoft.KeyVault/vaults@2021-10-01' = {
name: 'my-kv-001'
location: resourceGroup().location
properties: {
tenantId: subscription().tenantId
sku: {
family: 'A'
name: 'standard'
}
accessPolicies: [
for principalId in principalIds: {
objectId: principalId
tenantId: subscription().tenantId
permissions: {
secrets: ['Get', 'List']
}
}
]
}
}For more information about Bicep diagnostics, see Bicep core diagnostics.