azure-dev icon indicating copy to clipboard operation
azure-dev copied to clipboard

[Issue] `azd show` reports app not provisioned when it actually is

Open jongio opened this issue 3 months ago • 4 comments

I run azd show on an app that has been provisioned and I get this:

image

I looked through the azd code and it looks like it will return this message if it can't find the subid or rgName in the env.

I do see those values in my current env .env file, so not sure why I'm getting the error.

You should be able to repro by running azd provision and then azd show

jongio avatar Mar 27 '24 22:03 jongio

Hi, @jongio - We used a repo that already supports azd for testing. After executing azd provision, the error cannot be reproduced by executing azd show (provided that we have not deleted any parameters in the .azure/<env_name>/.env file).

I looked through the azd code and it looks like it will return this message if it can't find the subid or rgName in the env.

We also tried this. Since there is no rgName parameter in our .env file, we just remove the subid and then executed azd show, which can reproduce the error.

As far as I know, AZURE_SUBSCRIPTION_ID is automatically set in the .env file after the user executes azd provision and selects sub. (At the same time, the other two parameters AZURE_LOCATION and AZURE_ENV_NAME will also be set). So normally the AZURE_SUBSCRIPTION_ID parameter should exist. I'm not sure if it's reasonable for us to manually remove it (or in what scenario is it not set)?

Since resource group or even service with the same name can be created in different subs, I think subid is used to determine uniqueness. But at present, it seems that this error message: Application is not yet provisioned appears after provisioning is indeed a problem. Maybe we can optimize the error message after not finding the subid but finding the relevant parameters of other services? (just my thoughts)

Tested repo: todo-csharp-sql

azd version 1.7.0 (commit 49d6adc2efb178083f61822e6b4715258560803d)

zedy-wj avatar Mar 28 '24 03:03 zedy-wj

I discovered that there was a provisioning problem. Can you do this:

  1. Provision the application successfully.
  2. Get the template in a state where provisoining will fail. For example, Update the bicep file to have a syntax error.
  3. Then call azd show. to see if the above message appears

That will tell us if we get that generic message when AZD provisioning has a problem, and we can maybe improve that error message.

jongio avatar Mar 28 '24 16:03 jongio

@jongio - We tried this and the results were surprising, there is no expected error message: image

Steps to repro:

  1. azd provision (succeed)
  2. Updated main.bicep to have a syntax error.
  3. azd provision (fail)
  4. azd show (without error message)

zedy-wj avatar Mar 29 '24 03:03 zedy-wj

Can you please try it with https://github.com/jongio/hello-ai and see if you can figure out why it doesn't show the portal link?

jongio avatar Mar 29 '24 13:03 jongio