Skip to content
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

[Utilities] Added ManagementGroup-Deployment removal script #1622

Merged
merged 6 commits into from
Jul 4, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions utilities/tools/Clear-ManagementGroupDeployment.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@ Bulk delete all deployments on the given management group scope
Mandatory. The Resource ID of the Management Group to remove the deployments for.

.PARAMETER DeploymentStatusToExclude
Optional. The status to exlude from removals. Can be multiple. By default, we exclude any deployment that is in state 'running'.
Optional. The status to exlude from removals. Can be multiple. By default, we exclude any deployment that is in state 'running' or 'failed'.

.EXAMPLE
eriqua marked this conversation as resolved.
Show resolved Hide resolved
Clear-ManagementGroupDeployment -ManagementGroupId 'MyManagementGroupId'

Bulk remove all 'non-running' deployments from the Management Group with ID 'MyManagementGroupId'
Bulk remove all 'non-running' & 'non-failed' deployments from the Management Group with ID 'MyManagementGroupId'

.EXAMPLE
Clear-ManagementGroupDeployment -ManagementGroupId 'MyManagementGroupId' -DeploymentStatusToExclude @('running')

Bulk remove all 'non-failed' deployments from the Management Group with ID 'MyManagementGroupId'
AlexanderSehr marked this conversation as resolved.
Show resolved Hide resolved
#>
function Clear-ManagementGroupDeployment {

Expand All @@ -26,7 +31,7 @@ function Clear-ManagementGroupDeployment {
[string] $ManagementGroupId,

[Parameter(Mandatory = $false)]
[string[]] $DeploymentStatusToExclude = @('running')
[string[]] $DeploymentStatusToExclude = @('running', 'failed')
)
eriqua marked this conversation as resolved.
Show resolved Hide resolved

# Load used functions
Expand Down