Skip to content

enable build-params evaluation of for-expressions in .bicepparam#18949

Open
polatengin wants to merge 6 commits intomainfrom
polatengin/14722-bicepbcp338-when-dynamically-building-inputs-in-bicepparam-files-to-reduce-duplication
Open

enable build-params evaluation of for-expressions in .bicepparam#18949
polatengin wants to merge 6 commits intomainfrom
polatengin/14722-bicepbcp338-when-dynamically-building-inputs-in-bicepparam-files-to-reduce-duplication

Conversation

@polatengin
Copy link
Copy Markdown
Member

@polatengin polatengin commented Feb 3, 2026

Fixes #14722

Description

build-params now evaluates for-expressions in parameter assignments by expanding them at compile time, avoiding variables() runtime evaluation errors.

I also added coverage for this scenario in both CLI integration tests and core unit tests.

Checklist

Microsoft Reviewers: Open in CodeFlow

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 3, 2026

Test this change out locally with the following install scripts (Action run 23675574785)

VSCode
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-vsix.sh) --run-id 23675574785
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-vsix.ps1) } -RunId 23675574785"
Azure CLI
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-cli.sh) --run-id 23675574785
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-cli.ps1) } -RunId 23675574785"

@levimatheri
Copy link
Copy Markdown
Contributor

FYI the playground test has been fixed via this PR. You can merge/rebase from main.

@stephaniezyen stephaniezyen modified the milestones: v0.41, 0.42 Mar 4, 2026
@levimatheri
Copy link
Copy Markdown
Contributor

fyi I made some recent changes to ParameterAssignmentEvaluator that you might need to merge/rebase.

…pbcp338-when-dynamically-building-inputs-in-bicepparam-files-to-reduce-duplication

# Conflicts:
#	src/Bicep.Core/Emit/ParameterAssignmentEvaluator.cs
@polatengin
Copy link
Copy Markdown
Member Author

@levimatheri , I merged the changes on main . One of the McpServer unit tests fails, but since it's not related to what I've changed in this PR, I'm not fixing it 👍

Please review the PR, it's ready 😄

/// Rewrites the external input function calls to use the externalInputs function with the index of the external input.
/// e.g. externalInput('sys.cli', 'foo') becomes externalInputs('0')
/// </summary>
private class ExternalInputExpressionRewriter : ExpressionRewriteVisitor
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class isn't used anymore, we should remove it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

bicep(BCP338) when dynamically building inputs in .bicepparam files to reduce duplication

3 participants