Skip to content

Conversation

@levimatheri
Copy link
Contributor

@levimatheri levimatheri commented Dec 30, 2025

Description

For #18410. Enables piping and stdin/out redirection into the bicep console (i.e. piping | or file redirection < & output redirection '>`).

Example Usage

Powershell:
Piping:

image

Bash:
Piping:

image

Std-in redirection from file:

image

Multi-line support:

image

Output redirection:

image

Checklist

Microsoft Reviewers: Open in CodeFlow

@github-actions
Copy link
Contributor

github-actions bot commented Dec 30, 2025

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

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

@levimatheri levimatheri changed the title bicep console: Support piping input bicep console: Support stdin redirection Dec 30, 2025
@levimatheri levimatheri changed the title bicep console: Support stdin redirection bicep console: Support piping and stdin redirection Dec 30, 2025
@levimatheri levimatheri force-pushed the levi/console-piping branch 2 times, most recently from 49fd7c3 to 46ce8b6 Compare December 30, 2025 22:21

if (io.Input.IsRedirected)
{
// Read all input from stdin if redirected (via pipe or file redirection)
Copy link
Member

@anthony-c-martin anthony-c-martin Jan 5, 2026

Choose a reason for hiding this comment

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

Should we always disable ANSI color mode for output if output is being redirected?

Copy link
Contributor Author

@levimatheri levimatheri Jan 6, 2026

Choose a reason for hiding this comment

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

Good point, otherwise writing to a file looks weird and could complicate downstream pipelines consuming the output.

echo "split('foo,bar,baz', ',')" | bicep console > bicep_output.txt
image

Will make the change.

@levimatheri levimatheri changed the title bicep console: Support piping and stdin redirection bicep console: Support piping and stdin/out redirection Jan 11, 2026
@levimatheri levimatheri merged commit 2b1a92c into main Jan 13, 2026
71 of 72 checks passed
@levimatheri levimatheri deleted the levi/console-piping branch January 13, 2026 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants