Skip to content

Latest commit

 

History

History
61 lines (42 loc) · 1.16 KB

File metadata and controls

61 lines (42 loc) · 1.16 KB
title BCP040
description String interpolation is not supported for keys on objects of type <type-definition>.
ms.topic reference
ms.custom devx-track-bicep
ms.date 10/30/2025

Bicep diagnostic code - BCP040

This diagnostic occurs when the Bicep compiler can't determine the exact value of an interpolated string key.

Description

String interpolation is not supported for keys on objects of type <type-definition>.

Level

Warning / Error

Solution

Remove string interpolation.

Examples

The following example raises the diagnostic because string interpolation is used for specifying the key sku1:

var name = 'sku'

type storageAccountConfigType = {
  name: string
  sku1: string
}

param foo storageAccountConfigType = {
  name: 'myStorage'
  '${name}1': 'Standard_LRS' 
}

You can fix the issue by adding the missing properties:

var name = 'sku'

type storageAccountConfigType = {
  name: string
  sku1: string
}

param foo storageAccountConfigType = {
  name: 'myStorage'
  sku1: 'Standard_LRS' 
}

Next steps

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