NamedValue not getting replaced in Connection String for APIM Bicep #15904
Replies: 3 comments
-
I think it might be due to how the named-value is referenced. Try removing the |
Beta Was this translation helpful? Give feedback.
-
Yes, I tried that first, it fails with validation error |
Beta Was this translation helpful? Give feedback.
-
I think you can't use connection string with api-management. I think it only supports instrumentationKey like this: resource applicationInsightsLogger 'Microsoft.ApiManagement/service/loggers@2020-12-01' = {
parent: apiManagement
name: applicationInsightsName
properties: {
loggerType: 'applicationInsights'
credentials: {
instrumentationKey: '{{${applicationInsightsNamedValue.properties.displayName}}}'
}
}
} I'm using this widely and it works like a charm the named value can be a KV reference, it doesn't really matter as the API-M fetches the value into it's store and then it's used in policies or in above. |
Beta Was this translation helpful? Give feedback.
-
Bicep version
v0.31.92
Describe the bug
I have a namedValue defined for APIM that in turn refers it's value from a key vault secret, but when I try to use that namedValue in the connection string for Application Insights logger, it fails with this error.
"Validation failed for logger-id 'appi_logger_smi'. Exception Received 'Invalid instrumentation key for Application Insights Logger"
To Reproduce
Define a NamedValue like this
then try to access it in the logger.
Additional context
Add any other context about the problem here.
Beta Was this translation helpful? Give feedback.
All reactions