Improve the error for nested getSecret() calls in parameter files#20066
Conversation
|
Test this change out locally with the following install scripts (Action run 29541446351) VSCode
Azure CLI
|
|
Hi, Thank you for the contribution. |
You are correct. This PR implements only the diagnostic improvement described in #19934; it does not add support for nested This is currently constrained by the ARM deployment parameters contract. The official ARM deployment parameters schema and Resource Manager parameter file documentation defines each parameter entry as containing either a top-level "password": {
"reference": {
"keyVault": {
"id": "/subscriptions/.../providers/Microsoft.KeyVault/vaults/..."
},
"secretName": "password"
}
}ARM gives "credentials": {
"value": {
"password": {
"reference": {
"keyVault": {
"id": "/subscriptions/.../providers/Microsoft.KeyVault/vaults/..."
},
"secretName": "password"
}
}
}
}is treated as ordinary object data and is not resolved as a Key Vault secret by ARM. Until ARM adds support for Key Vault references within structured parameter values, Bicep cannot emit nested This PR only detects the unsupported placement earlier and reports the actionable |
Description
Fixes #19934
ARM supports Key Vault references as complete parameter values. It does not support them inside objects or arrays.
This change detects nested
getSecret()calls earlier and reportsBCP351error.Top-level
getSecret()assignments and supported extension configuration assignments continue to work.I've added tests for
getSecret()calls;az.getSecret()callsBefore the fix, all new tests failed with
BCP338, after the fix, they pass and reportBCP351as expected.The existing parameter-file and extension configuration tests also pass.
Checklist