azure-dev
azure-dev copied to clipboard
[Issue] outputs from main.bicep added to .azure/.env occasionally include a casing error
- [x] Make sure you've installed the latest version using instructions in the wiki
Output from azd version
Run azd version
and copy and paste the output here:
azd version 0.1.0-beta.4 (commit fd96b3e9b283598bc4dc736e893f1b47080fbf7d)
Output from az version
Run az version
and copy and paste the output here (minimum required version is 2.38.0):
azd version 0.1.0-beta.4 (commit fd96b3e9b283598bc4dc736e893f1b47080fbf7d)
Describe the bug Description of issue you're seeing... Occasionally (not always) outputs from main.bicep are exported to .env with casing errors:
output POSTGRES_USER string = binding.outputs.POSTGRES_USER
results in:
pOSTGRES_USER=XXXXXXX
To Reproduce Output variables from main.bicep
Expected behavior Environment variables should respect casing when added to .env file.
Related? https://github.com/Azure/azure-dev/issues/289
This is somewhat surprising as we do explicit work to try to prevent this from happening. ARM does not retain the case of output property names (this is a known issue) in the deployment object and so we use ARM Template to discover the canonical case of the outputs and then use that when updating the environment.
That logic lives here: https://github.com/Azure/azure-dev/blob/eff5410e6e0d1cac190823ee0ab5dfa06f43c1c4/cli/azd/pkg/iac/bicep/compile.go#L41-L59
It's possible that we aren't running it in some cases?
@greenie-msft You mentioned this is intermittent - I'm wondering what azd
command you're running when you trigger this? The intermittentness concerns me.
Also - when this happens is the original (correctly cased) POSTGRESS_USER
removed from the environment or is it still around as well as the bad cased version?
@ellismg, I just reviewed my shell history and the command I used (every time) was : azd env set POSTGRES_USER XXXX
When behavior occurs, it does not remove the correct environment variable from previous attempts. I had the below in my .env file:
POSTGRES_USER=XXXX pOSTGRES_USER=XXXX
@greenie-msft since you said occasionally. Did you run into this recently?
I'm consistently running into this on a MacBook. Will investigate further, but at a glance:
- The casing in
.env
file is correct - When running
bicep build
of the.bicep
file, the outputs have correct casing - But in the deployment, I can see the casing is messed up:
Suspicious that ARM may be involved here.