Azure / azure-dev

A developer CLI that reduces the time it takes for you to get started on Azure. The Azure Developer CLI (azd) provides a set of developer-friendly commands that map to key stages in your workflow - code, build, deploy, monitor, repeat.
https://aka.ms/azd
MIT License
410 stars 198 forks source link

Bicep parameters with default values are always passed as null #4206

Open TWolversonReply opened 2 months ago

TWolversonReply commented 2 months ago

Output from azd version azd version 1.9.5 (commit cd2b7af9995d358aab33c782614f801ac1997dde)

Describe the bug Bicep parameters with default values are always passed as null, regardless of config.json

To Reproduce Steps to reproduce the behavior...

Expected behavior Define a parameter with a default value in main.bicep param clientTags string = '{}'

azd provision doesn't prompt for it, which is expected, but the deployment behaves as though the param is null, regardless of what the default value is actually set to.

Crucially, supplying a value in config.json for the current environment makes no difference, the parameter is still null.

Environment Information on your environment:

Additional context Add any other context about the problem here.

rajeshkamal5050 commented 2 months ago

@jongio @vhvb1989 don't think azd passes/translates such default empty string params as null for deployment? any tips/tricks to handle it in bicep itself?

vhvb1989 commented 2 months ago

@TWolversonReply The parameter mapping is set on main.parameters.json (not in config.json). config.json is used when bicep parameters have no default value. azd prompts for the value and saves it to config.json. Check if there is a mapping for your parameter in main.parameters.json, in your infra folder