On the project I am working we use azure services. When i was working on my old computer it all worked fine.
I had to switch computer recently and i cloned the code from devops, so the code should work. I installed the Azure Developer CLI and now when I try to build the project i get the following error:
My code is organized in the following way and as you can see there is the .azure folder in which i have the env file (I updated the folder name now but also with the original name i get the same error)
Azure Developer CLI does not recognize environment:
It is possible that your issue could be temporary and may have occurred as certain environment setups were missing after cloning the code.
The Azure workload extensions in VS Code are meant for specific project types and also each one has a very specific purpose based on their functionality.
If your project from DevOps is not related towards Azure development or doesn't use a supported or relevant framework, you won't be able to access to the Azure developer environment.
Need to check below:
After cloning the code, restart the VScode as the environment takes some time to load the environment set up variables automatically.
Check if the Azure Developer CLI extension has installed properly without any issues. Also check the azd
whether it is according to the latest releases.
Try to retrieve the list of environments using below azd
command. If the specific environment is shown in the output, then the issue is not with env files. It might be due to VScode functionality. Or else check the environment configurations as explained above.
azd auth login
azd env list
Refer Developer CLI setup MSDoc
Reference: Developer CLI works with Azure environments