-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deleting deployment in a resource group doesn't delete the resources in the deployment #585
Comments
Hi @lyan-git. Thank you for reaching out. What you are experiencing is exactly what I ran into initially when developing in ARM. I expected that when I delete a deployment, that all of the resources created in that deployment would also be deleted. Unfortunately, that is not the case. To clean up a deployment, you will have to delete the resources one by one, or you would need to delete the resource group. That is why I usually create a new resource group for each of my deployments. That way, I can just delete the resource group, and that would cause all of my resources to be deleted as well. I hope this helps. If you have any questions, please ping back. I'm going to close the issue, but don't let that discourage further conversation. |
Hi David, Thanks for your reply. Just my 2 cents. Hope to hear back from you. Thanks. |
Thank you for your thorough explanation of why and how you are approaching this problem. I'm including @ravbhatnagar from the Azure Resource Manager team to provide some additional guidance (and to correct me if I'm guiding you down the wrong path). As far as I know, you will need to delete the resources one by one. You don't need to delete the whole resource group as that will delete all of the resources in that group.
As I had mentioned before, I thought the same way about deployments as you are thinking about them, but deleting a deployment does not remove the resources deployed in that deployment. In fact, I'd love to see Azure Resource Manager function this way with regard to deployments. |
@lyan-git - Yes, deleting the resource group will delete all the resources in that resource group. So if you want to only delete specific resources, you will have to delete the resources individually. However, depending on your scenario, there might be another option. If all these resources, are now part of the same template, you can remove the resources you don't need anymore from the template. Then deploy that template to the same resource group but using Mode = Complete. This is delete all the resources that are not defned in your template but present in your resource group. Does that make sense? Let me know if you have further questions on this. I would be happy to discuss this further. |
I thought that is what the delete API of the deployment suppose do. So you create a deployment with a template of resources as a logical group in a resource group and when you delete the deployment the resources in the template are removed. Right now the delete of the deployment is not removing any of the resource in the deployment as a delete of resource group does. Thanks. |
|
Hi,
I was trying to delete a resource group deployment by calling
resource_client.deployments.delete()...
But found that the deployment was gone but the resources in the deployment were not deleted actually. Tried with ARM portal as well, same result.
I know this is not related to SDK but more of the result of REST API. Just want to find out a way to delete the deployment and included resources without deleting resource group.
Thanks.
Li
The text was updated successfully, but these errors were encountered: