-
Notifications
You must be signed in to change notification settings - Fork 187
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
Add script for removing worm storage accounts #4959
Conversation
} | ||
} | ||
if ($PSCmdlet.ShouldProcess($group.ResourceGroupName)) { | ||
Remove-AzResourceGroup -ResourceGroupName $group.ResourceGroupName -Force -AsJob |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wrapping this instead of just using the native WhatIf because even with WhatIf it still farms it out to a job which can be misleading and make the user think the group is actually being deleted.
if ($PSCmdlet.ShouldProcess($group.ResourceGroupName)) { | ||
Write-Host "Removing $($account.StorageAccountName) in $($account.ResourceGroupName)" | ||
} else { | ||
Write-Host "What if: Removing $($account.StorageAccountName) in $($account.ResourceGroupName)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the whatif logic in shouddprocess would already output this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you want to ship if whatif is set? I see you are still calling remove below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed it up to just check $WhatIfPreference
. The extra stuff from the ShouldProcess
log makes the output hard to parse in my opinion.
I still call Remove below because the parent -WhatIf
will still pass through to the Az calls and I want those to be part of the whatif logging since it shows each container that would be deleted.
d68cb65
to
2e7c104
Compare
No description provided.