Thank you for reaching out to Microsoft Q&A!
Firstly, when you are trying to delete a deployment stack created at subscription scope level delete the resource groups or resources existed in it through portal or any other script. To allow the delete resource operations in the stack, make sure that the DenySettingsMode
is set to None
and delete it accordingly.
I deployed a deployment stack in the Azure portal, added a few resources to it, and attempted the delete operation using the "Delete stack" button and click on Detach resources option under "Update behavior". It worked as expected.
And to delete the deployment stack at subscription level, you need to use az stack sub delete
AZCLI command as detailed in below MS Doc.
Link: https://learn.microsoft.com/en-us/cli/azure/stack/sub?view=azure-cli-latest#az-stack-sub-delete
If still the issue persists and to apply force delete on the deployment stack deletion operation, there is a relevant Az PowerShell command called Remove-AzSubscriptionDeploymentStack
with stack name and force arguments.
I have executed it in my environment and was able to perform it successfully without any conflict.
Note: I can see that the error message is likely "DeploymentStackDeleteResourcesFailed", it exactly means that Azure could not be able to remove some resources on deployment stacks. As suggested in your error message, go to the corresponding resource groups where the resources have been deployed and delete them manually.
Hope this helps.
If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.