Skip to content

Add option to not delete resource group when running azd down command #4785

@Lunatico9

Description

@Lunatico9

Describe the feature or problem you’d like to solve

Presently, it appears that the azd down command always deletes the entire resource group and there isn't any way to change that (unless I'm missing something in the documentation). This discourages the use of azd down if the user running the command doesn't have subscription-wide permissions to create a new resource group and must use an existing resource group created by someone else, with the template modified for a resource group scoped deployment.

In such cases, the user needs to manually delete the individual resources through the Azure Portal or Azure CLI to avoid deleting the resource group, thus pulling the user away from using azd exclusively and towards using other tools. This has been my personal experience.

It would be useful to be able to choose whether the resource group gets deleted or not.

Proposed solution

I think this could be an additional flag for the azd down command that allows you to choose whether the resource group gets deleted or not. It might be worth exploring whether it makes sense to have the resource group be not deleted by default when targetScope = 'resourceGroup' inside main.bicep.

Looking at a comment in a previous issue, it seems that azd currently always deletes the resource group without looking at the inside resources. This would probably have to change to allow for not deleting the resource group.

Additional context

What shows up when I try to run azd down even though I want to avoid deleting the resource group:

Image

For context, there are only 8 individual resources within this resource group, meaning that the displayed total of 9 resources to delete must also include the resource group itself. I don't want the resource group to be deleted.

Metadata

Metadata

Labels

Type

No fields configured for Task.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions