Coder Perfect

How do I stdout a variable or parameter?

Problem

I’m attempting to troubleshoot my first Bicep template.

How can I simply publish the value of a variable or parameter to standard output?

Something like:

var hello = 'hello world!'
write-host(hello)

Asked by Nathan

Solution #1

Using module outputs that you can read from Portal is the best option. Module deployments are distinct deployments that can be seen in the “Deployments” section of a resource group, subscription, or other type of resource. Even if the top-level deployment fails, the outputs from modules inside that were successful, as well as the parameters they used, can be accessed.

Because bicep is a declarative language rather than an imperative one, the file is not processed in order.

Answered by Miq

Post is based on https://stackoverflow.com/questions/67936416/how-to-write-a-variable-parameter-to-stdout