az.getSecret() with externalInput parameters builds invalid resourceId function
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- azure
- Domain
- cloud
Research direction
Start by searching the Bicep codebase for getSecret() parameter compilation and the code that builds the Key Vault resourceId expression. Reproduce with the supplied .bicepparam example and inspect the generated reference.keyVault.id. The fix is done when the resource type is emitted as the single 'Microsoft.KeyVault/vaults' argument and the compiled parameters deploy without the reported resourceId error.
Written by the indexing model from the issue text.
Description
Bicep version
Bicep CLI version 0.49.2 (b34271ac51)
Describe the bug
When compiling a bicepparam file with a parameterized Key Vault secret value, e.g., az.getSecret(externalInput('sid'), externalInput('rg'), externalInput('kv'), externalInput('sn')), the resulting parameter's Key Vault ID is [resourceId(externalInputs('sid'), externalInputs('rg'), 'Microsoft.KeyVault', 'vaults', externalInputs('kv'))].
The separate 'Microsoft.KeyVault' and 'vaults' arguments should be the single string 'Microsoft.KeyVault/vaults'.
Trying to deploy with the compiled JSON fails with this error message:
Error: Code=InvalidTemplate; Message=Deployment template language expression evaluation failed: 'Unable to evaluate template language function 'resourceId': function requires exactly one multi-segmented argument which must be resource type including resource provider namespace.
To Reproduce
// test.bicep
@secure()
param secretValue string
// test.bicepparam
using 'test.bicep'
param secretValue = getSecret(externalInput('subscriptionId'), externalInput('resourceGroupName'), externalInput('keyVaultName'), externalInput('secretName'))
az bicep build-params --file test.bicepparam
Produces:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"secretValue": {
"reference": {
"keyVault": {
"id": "[resourceId(externalInputs('subscriptionId_0'), externalInputs('resourceGroupName_1'), 'Microsoft.KeyVault', 'vaults', externalInputs('keyVaultName_2'))]"
},
"secretName": "[externalInputs('secretName_3')]"
}
}
},
"externalInputDefinitions": {
"keyVaultName_2": {
"kind": "keyVaultName"
},
"resourceGroupName_1": {
"kind": "resourceGroupName"
},
"secretName_3": {
"kind": "secretName"
},
"subscriptionId_0": {
"kind": "subscriptionId"
}
}
}
Additional context
- Dominant language
- Bicep
- Stars
- 3.7k
- Forks
- 833
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 81
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Azure/bicep
-
enhancement Needs: Upvote VisualStudio
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Azure/bicep#17997 · 1 reaction ·
Maintainers usually reply within 1 day
-
AI Triaged Needs: Triage :mag: OnlyifNotExists
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Azure/bicep#20634 · 2 comments ·
Maintainers usually reply within 1 day
-
AI Triaged bug Needs: Triage :mag:
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Azure/bicep#20584 · 2 comments ·
Maintainers usually reply within 1 day
-
Preserve member types through open-object union() and spreads instead of rebuilding them in secret analysisPossibly taken @andyleejordan claimed this 21 days ago. OpenAI Triaged enhancement linter-false-positive Needs: Triage :mag: story: linter type system
Azure/bicep#20558 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
AI Triaged investigate Needs: Triage :mag: revisit
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Azure/bicep#20556 · 2 comments ·
Maintainers usually reply within 1 day
Similar issues
-
area: budget priority: low type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
scttfrdmn/cargoship#1535 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Chocobozzz/PeerTube#7901 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Azure/sap-automation#1417 ·
Maintainers usually reply within 2 days
-
area-integrations
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day