Closed slavizh closed 2 years ago
Thanks for asking - this has caused a fair bit of confusion to this point, so I'm hoping this will help clarify. We are open to feedback on how to clarify this behavior.
In order to purgeResources, the property must be specified at the time of the deployment where resources are becoming unmanage. For example:
Iteration 1: Stack deploys resources A, B, C -- the purge option can be set, but it functionally does nothing (since no resources were part of the stack before). Iteration 2: Template is updated to A, B, D. If purgeResources is specified, C will be deleted. Iteration 3: Template is updated to A, D, E. If nothing is specified, the default behavior is detach, and B will remain in Azure. Delete stack: In the current preview, all resources are detached. This is documented in the 'known issues' section. With our next release, there will be an option to specify that resources should be deleted along with the deployment stack.
Here is the 'known issue' from the release notes:
In the preview, deleting a deploymentStack detaches all of its managed resources. To delete all the managedResources, first update the deploymentStack with an empty template and set -UpdateBehavior PurgeResources. After that completes, delete the deploymentStack. Note the scope resources (resource group, management group, subscription, and tenant) and the implicitly created resources (i.e. a VMSS resource is implicitly created when an AKS resource is created) are not deleted.
Issue #59 is also relevant here - we are renaming the property to clarify this behavior.
I will close this issue -- if you have feedback for how to make this more intuitive, please comment on #59.
thanks. I guess due to some time between previous preview and current preview I have forgotten this known issue.
Describe the bug I have deployed stack with purgeResources option. I am doing Remove-AzSubscriptionDeploymentStack but the resource group and the resources that are in the stack are not removed. If I am not mistaken that was the intent of the command?
To Reproduce Steps to reproduce the behavior:
Expected behavior Resource group and resources created by the stack are not removed
Screenshots If applicable, add screenshots to help explain your problem.
Repro Environment Host OS: Windows Powershell Version: 7.2.5
Server Debugging Information Correlation ID: Tenant ID: eeb91fce-4be2-4a30-aad8-38e05fefde07 Timestamp of issue (please include time zone): Data Center (eg, West Central US, West Europe):
Stack ID: /subscriptions/3c1d68a5-4064-4522-94e4-e0378165922e/providers/Microsoft.Resources/deploymentStacks/lz-analysis-services-monitoring
Additional context Add any other context about the problem here.