In Bicep, while any is conceptually supported, it's not directly specified as a valid parameter type. You can work around this by using conditional logic based on the expected input types (like int, string, bool). I updated the template like below :
param appConfigName string
param appConfigKey string
param appConfigValue string // Change "any" to "string"
param isKeyVaultRef bool
var contentTypeKeyVaultRef = 'application/vnd.microsoft.appconfig.keyvaultref+json;charset=utf-8'
var contentTypeString = ''
resource AppConfigurationResource 'Microsoft.AppConfiguration/configurationStores@2021-03-01-preview' existing = {
name: appConfigName
}
resource ConfigStoreKeyValue 'Microsoft.AppConfiguration/configurationStores/keyValues@2021-10-01-preview' = {
parent: AppConfigurationResource
name: appConfigKey
properties: {
value: isKeyVaultRef ? '{"uri":"${appConfigValue}"}' : appConfigValue
contentType: isKeyVaultRef ? contentTypeKeyVaultRef : contentTypeString
}
}
If you’re passing integers or booleans, you can convert them to strings at the calling template level. This way, all values are received as strings in the main template.
module appConfigPatchPlainValues '../../shared/modules/configStorePatch.bicep' = [for pv in plainValues: {
name: 'deploy-${configStoreName}-${replace(pv.key, ':', '-')}'
dependsOn: [
configStoreModule
]
params: {
appConfigName: configStoreName
appConfigKey: pv.key
appConfigValue: string(pv.value) // Convert all to string
isKeyVaultRef: false
}
}]