Closed luisquintanilla closed 1 week ago
If I try to set environment variables or run azd up, it chooses the old cached environment instead of my default.
Is it possible that AZURE_ENV_NAME
environment variable has been set in the shell?
Print current value:
echo $env:AZURE_ENV_NAME
Unset current value:
$env:AZURE_ENV_NAME = ''
You can also use azd env select <name>
to set the explicit default environment.
If I try to set environment variables or run azd up, it chooses the old cached environment instead of my default.
Is it possible that
AZURE_ENV_NAME
environment variable has been set in the shell?Print current value:
echo $env:AZURE_ENV_NAME
Unset current value:
$env:AZURE_ENV_NAME = ''
You can also use
azd env select <name>
to set the explicit default environment.
Looks like that may be it.
echo $env:AZURE_ENV_NAME
openaidemo100523
I'll give it a try and report back if this fixed the issue.
Removing the environment variable worked. Marking this issue as fixed and closing. Thanks @weikanglim
Reopening this issue.
While some of the resources used the correct environment, it seems like others are picking the wrong unexistient environment.
@weikanglim are there other places where this might be cached?
@luisquintanilla There shouldn't be any other items that would cause a forced environment selection. What commands aren't working for you? Would you mind providing the command being ran and the command output?
@luisquintanilla There shouldn't be any other items that would cause a forced environment selection. What commands aren't working for you? Would you mind providing the command being ran and the command output?
I just ran azd up
since it's the first time I'm provisioning these services.
@luisquintanilla Is it possible that you have AZURE_RESOURCE_GROUP
set explicitly either in the shell, or in the environment's .env
file that has the old value?
# AZURE_RESOURCE_GROUP value in shell
echo $env:AZURE_RESOURCE_GROUP
# Also print values out from the .env file
azd env get-values
You may want to verify all AZURE_
environment variables set in the shell as well:
gci env: | ? { $_.Name.StartsWith("AZURE_") }
And if the environment variables are set at the User
or Machine
level (they re-appear after opening a new terminal), you may need to remove them at the right scope. See this stack overflow post.
That did the trick. Thanks again @weikanglim. Closing.
Output from
azd version
Runazd version
and copy and paste the output here:Describe the bug When trying to deploy an application (.NET Aspire) using azd, there is an old environment that appears to be cached.
However, that environment is not in my .azure directory.
When I create a new environment, it sets it as the default.
If I try to set environment variables or run
azd up
, it chooses the old cached environment instead of my default.To Reproduce Not sure how to reproduce since the old environment that's been cached is not on my machine.
Expected behavior azd uses default environment.
Environment Information on your environment:
Additional context