Prompt for Values With Bicep

With Bicep, we can configure our templates to prompt for a value during a resource deployment.

Prompting for a value is a secure method to capture information like passwords during runtime rather than hard code passwords and other sensitive information.

I have a parameter in the code below that prompts the user to enter a password during runtime. I’m also using the @secure method to hide the password from the logs.

Note: The @description decorator will display the text in the Azure portal if the template is deployed from the portal.

@secure()
@description(' Administrator password')
param administratorLoginPassword string 

When the code is run from VS Code, the following prompt will show up and ask the user to type a password.

About Bicep

The Resource Manager template language Azure Bicep enables you to deploy Azure resources declaratively. It’s a domain-specific language, which implies it was created specifically for the purpose of deploying Azure resources. Bicep is only used to create Resource Manager templates.

Bicep is designed to be simple to understand and learn, regardless of your prior experience with other programming languages. Bicep templates can use all resource types, API versions, and property values.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.