Nathan
Nathan

Reputation: 6216

How to write a variable/parameter to stdout?

I'm trying to debug my first Bicep template.

How can I just write a variable or parameter value to standard output?

Something like:

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

Upvotes: 13

Views: 13997

Answers (2)

Christopher G. Lewis
Christopher G. Lewis

Reputation: 4835

I created some simple hello world type templates early on in Bicep's history for this type of question https://github.com/Azure/bicep/tree/main/src/Bicep.Core.Samples/Files/user_submitted/000/01-hello-world .

The've been moved around and are harder to find, but still helpful.

Upvotes: 4

Miq
Miq

Reputation: 4289

The best is to use module outputs which you can read from Portal. Module deployments are separate deployments visible in the "Deployments" section of resource group / subscription / etc. Even if the top-level deployment will fail, outputs from modules inside that were successful can be read, alongside parameters they took.

Remember, that bicep is a declarative language, not imperative, so the file is not being processed sequentially.

Upvotes: 13

Related Questions