Open savannahostrowski opened 1 year ago
cc: @ellismg for input here too!
We have an empty config at this point and the user has not yet been walked through the subscription/region flow so azd thinks the environment doesn't exist.
This is a good issue. We certainly have gaps here.
For refresh
to work today, we have to find the most recent deployment that corresponds to the user's infrastructure.
For subscription based deployments, we need to know the subscription ID so we can list all the deployments and find the one tagged with azd-env-name
that corresponds to the environment they are trying to refresh.
For resource group based deployments, we need to know both the subscription and the target resource group.
So, before we can preform the refresh
operation, we will need to prompt the user for what subscription they want to use. We can recover the AZURE_LOCATION
setting by using the location of the most recent deployment, so we shouldn't need to prompt for that value.
It seems like when running the command azd env refresh <env-name>
if env-name
doesn't exist, we shouldn't prompt if the user wants to create this (their intention is pretty clear from the command) but we will still need to ask about which subscription (and possibly resource group) to use and then do the refresh.
@ellismg @savannahostrowski adding it to the Germanium bucket. We can pull it into iterations/sprints as part of planning.
I'd like to work on fixing this.
@savannahostrowski / @ellismg - i wonder if App Spaces would be a good candidate for a remote environment provider
The root cause of this issue is the execution of the function in the pkg/environment Manager.LoadOrCreateInteractive()
as it's a part of the initialization process of a new environment so, any package that depends on the environment package will trigger this function first.
These are some things I tried and they did not work:
1- remove the packages that have *environment.Environment
found three projectManager
, provisioningManager
, env
. ==> (Bad path - can't remove them as they are essential for the current functionality)
2- fixing the function that does this Environment.Manager.LoadOrCreateInteractive()
==> (some progress - using provisioing.Manager.EnsureSubscriptionAndLocation()
creates circular dependency between packages)
3- refactoring the code to be able to use the EnsureSubscriptionAndLocation() function or replicate its functionality without using it in Environment.Manager.LoadOrCreateInteractive()
.
I tried but everything I try changes the functionality of the existing code so, I suggest we create a new Prompter package that doesn't depend on the Environment with the needed functionality. plus, for Resource groups don't show an option to create a new resource group.
Let me outline a UX flow from Azure App Spaces. However, this is relevant beyond just the Azure App Spaces scenario.
azd auth login
azd env refresh <env name>
to pull the env metadata downNotice that you get this error:
We have an empty config at this point and the user has not yet been walked through the subscription/region flow so azd thinks the environment doesn't exist.