[Do not merge] Allow expressions in getSecret function#19204
Open
levimatheri wants to merge 4 commits intomainfrom
Open
[Do not merge] Allow expressions in getSecret function#19204levimatheri wants to merge 4 commits intomainfrom
getSecret function#19204levimatheri wants to merge 4 commits intomainfrom
Conversation
getSecret functiongetSecret function
Contributor
|
Test this change out locally with the following install scripts (Action run 23161978702) VSCode
Azure CLI
|
anthony-c-martin
approved these changes
Mar 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change is pending backend rollout.
Description
This pull request introduces enhanced support for the
az.getSecretfunction in Bicep parameter files, allowing both compile-time constant and expression-based arguments for Key Vault secret retrieval. The changes update the function overloads, expression handling, and test coverage to ensure that parameter files correctly generate Key Vault references, including scenarios with external inputs. The most important changes are grouped below by theme.Important:
If string literal types are used for the
getSecretfunction, then emit KV reference as before (i.e. not usingresourceId()function. This prevents breaking people since the Deployments API will reject expressions in secret references below api-version2025-04-01Key Vault Secret Retrieval Improvements
az.getSecretfunction overload to accept both string literals and expressions for parameters, removing the compile-time constant restriction and supporting dynamic external inputs.ParameterKeyVaultReferenceExpressionto useExpressionobjects forKeyVaultId,SecretName, andSecretVersion, allowing more flexible and dynamic expression handling.JSON Emission and Transformation
ParametersJsonWriterto emit Key Vault references usingEmitPropertyWithTransform, enabling transformation of expressions (such as external inputs) when generating parameter files.Example Usage
Checklist
Microsoft Reviewers: Open in CodeFlow