Repository navigation
Description
Bug Report
Description
When publishing loggers with override files that contain named value references ({{...}} syntax) inside the credentials property, the named value reference is not substituted/resolved before the PUT request is sent to APIM. This causes a 400 ValidationError.
Error Message
HTTP 400: {"error":{"code":"ValidationError","message":"One or more fields contain incorrect values:","details":[{"code":"ValidationError","target":"One or more Properties ['{0}'] specified are missing.","message":"Logger-Credentials--6566f39dfb426808c40853a6"}]}}
Override File (Reproduction)
`yaml
loggers:
- name: apim-uk-appinsights
properties:
loggerType: applicationInsights
description: prod application insights
resourceId: "/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/MyResourceGroup/providers/microsoft.insights/components/APIM-Prod-AppInsights"
credentials:
instrumentationKey: "{{Logger-credentials--658acc09217d201b30974554}}"
isBuffered: true
diagnostics: - name: applicationinsights
properties:
verbosity: information
loggerId: "/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/MyResourceGroup/providers/Microsoft.ApiManagement/service/prod-apim-uk-01/loggers/APIM-Prod-AppInsights"
`
Expected Behavior
The {{Logger-credentials--658acc09217d201b30974554}} named value reference in the credentials.instrumentationKey field should be resolved or passed through correctly so that APIM can process the logger creation/update without error.
Actual Behavior
The named value reference is not being substituted. APIM returns a 400 ValidationError indicating the referenced named value property is missing, suggesting the {{...}} reference is not being handled correctly in the credential field context.
Analysis
The credentials field in logger resources uses APIM's named value reference syntax ({{namedValueName}}). During publish, the override is applied via applyOverrides() which deep-merges the value into the resource JSON. The named value reference inside credentials is not being resolved before the API call to APIM.
This may be because:
- The named value referenced doesn't exist yet at publish time (ordering issue — named values should be published before loggers that reference them)
- The
{{...}}reference syntax requires special handling in thecredentialsproperty context that differs from how it works in policy XML - The reference value is being transformed or escaped during processing
Relevant Code
src/services/override-merger.ts—applyOverrides()deep-merges override valuessrc/services/resource-publisher.ts:112— callsapplyOverridesduring publishsrc/services/publish-service.ts:253-257— named values published first (wave 1), but loggers are also tier 1src/models/config.ts:82-85—LoggerOverrideinterface (supportscredentialsfield)
Steps to Reproduce
- Have a logger resource that uses Application Insights with credentials referencing a named value
- Create an override file with the logger's
credentials.instrumentationKeyset to a named value reference{{Logger-credentials--<id>}} - Run
apiops publishwith the override file - Observe 400 error from APIM
Activity
fix: resolve named value reference and schema ref issues in publish