-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Variables created in preprovision hook with azd env set
are not available in the same script
#4611
Comments
We are following up on this issue. cc @rajeshkamal5050 |
@dayland Azd's underlying layer loads environment variables from In addition, for the script file, you can also change it to the following:
|
Thanks for the follow up. I did find in the documentation where it shows an example of loading the ENV file into a script as needed, although not called out in the documentation itself. I guess this is more of a future consideration for enhancement that would align with assumptions that |
@dayland To clarify, the When executing hooks, azd will first load environment variables from the We think this design is reasonable at present. If you have more ideas, we can also discuss. |
@rajeshkamal5050 When setting environment variables using We think the behavior is reasonable design. Do you think this is an enhancement issue? |
Output from
azd version
azd version 1.11.0 (commit 5b92e06)
Describe the bug
I have set up a shell script to run in preprovision hook.. when running this script I am unable to use the variables I have set using
azd env set
for conditional checks in the same script without manually loading the.azure/<environment>/.env
in.To Reproduce
Steps to reproduce the behavior...
Assume you have the following
azure.yaml
:my
prepare-tf-variables.sh
script is:I want the user to only have to specify the
AZURE_ENVIRONMENT
variable and then conditionally set additional variables based on it. However, this does not work becauseAZURE_ENVIRONMENT
is not recognized in the if condition. I have had to modify the script to do the following for the conditional parts to work...Expected behavior
I would expect that as I add values to the AZD environment using
azd env set
they would be available for immediate use.Environment
Information on your environment:
* Linux Debian devcontainer [python-3.12-bookworm]
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: