Azure / azure-dev

A developer CLI that reduces the time it takes for you to get started on Azure. The Azure Developer CLI (azd) provides a set of developer-friendly commands that map to key stages in your workflow - code, build, deploy, monitor, repeat.
https://aka.ms/azd
MIT License
403 stars 195 forks source link

[Issue] Fail to run `azd down` after creating `apicenter` resources #3631

Open dotnet-7 opened 6 months ago

dotnet-7 commented 6 months ago

Describe the issue: Run azd down, get error as follow:

image

We created an apicenter resource using the version 2024-03-01/2023-07-01-preview, while the version in the error log is 2024-03-15-preview. Also, we can't use the 2024-03-15-preview version, for its not available in bicep yet.

Repro Steps:

  1. Init the template: azd init -t dotnet-7/APICenter-Analyzer-justinyoo -b feature/azd-template.
  2. Login: azd auth login and az login.
  3. Deploy resources: azd provision.
  4. Delete resources: azd down --force --purge.

Environment:

Expected behavior: Run azd down can pass and all the resources are deleted.

@rajeshkamal5050 for notification.

rajeshkamal5050 commented 6 months ago

@weikanglim can you triage this?

rajeshkamal5050 commented 6 months ago

@dotnet-7 - Currently the error in down seems to be caused by an error which happened during provisioning.

Getting the apicenter provisioning to be successful. Should fix azd down.

cc @hemarina @weikanglim please chime-in you find something else.

weikanglim commented 6 months ago

@dotnet-7 Based on the error message, it's likely that the error is occurring upstream on the ARM service. azd is making a DELETE call on the resource group:

DELETE https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}?api-version=2021-04-01

The resources, which includes Microsoft.ApiCenter in this case, would be expected to be deleted. However, ARM failed to delete the resource based on the API version mismatch in this case.

Does it also reproduce if you delete the resource group containing the Microsoft.ApiCenter in the Azure Portal? Or via az group delete -n <resource group>? I'm not sure what causes this -- it's likely that there's a mismatch of API versions somewhere in the ARM services.

dotnet-7 commented 6 months ago

@weikanglim - I tried to delete apicenter in the Azure Portal directly and it gave the same error as below:

image

Could you please contact service team to help us with it? We are not sure who can fix this.