Edit

Stop-AzManagementGroupDeployment

Cancels a running management-group deployment.

Syntax

StopByDeploymentName (Default)

Stop-AzManagementGroupDeployment
    [-ManagementGroupId] <string>
    [-Name] <string>
    [-PassThru]
    [-Profile <string>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

StopByDeploymentId

Stop-AzManagementGroupDeployment
    -Id <string>
    [-PassThru]
    [-Profile <string>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

StopByInputObject

Stop-AzManagementGroupDeployment
    -InputObject <DeploymentExtended>
    [-PassThru]
    [-Profile <string>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Aliases

This cmdlet has no aliases.

Description

Cancels a deployment in Accepted or Running state. The target can be supplied by management group and name, full deployment ID, or pipeline input object. The cmdlet sends the cancellation request directly; Azure Resource Manager checks the deployment state. Cancellation does not roll back resources already deployed. No deployment object is returned.

Examples

Example 1

Cancels a deployment by management group and name.

Stop-AzManagementGroupDeployment -ManagementGroupId myManagementGroup -Name myDeployment -Confirm:$false

Example 2

Cancels a deployment supplied through the pipeline and returns true on success.

Get-AzManagementGroupDeployment -ManagementGroupId myManagementGroup -Name myDeployment |
    Stop-AzManagementGroupDeployment -PassThru -Confirm:$false

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Id

The full management-group deployment resource ID, for example /providers/Microsoft.Management/managementGroups/myManagementGroup/providers/Microsoft.Resources/deployments/myDeployment. Use this instead of -ManagementGroupId and -Name.

Parameter properties

Type:String
Supports wildcards:False
DontShow:False
Aliases:DeploymentId, ResourceId

Parameter sets

StopByDeploymentId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InputObject

A deployment object returned by Get-AzManagementGroupDeployment. Its Id identifies the deployment to cancel. Accepts pipeline input.

Parameter properties

Type:Microsoft.Azure.Azclips.Extensions.Resources.Models.DeploymentExtended
Supports wildcards:False
DontShow:False

Parameter sets

StopByInputObject
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-ManagementGroupId

The management group ID.

Parameter properties

Type:String
Supports wildcards:False
DontShow:False

Parameter sets

StopByDeploymentName
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

The deployment name.

Parameter properties

Type:String
Supports wildcards:False
DontShow:False
Aliases:DeploymentName

Parameter sets

StopByDeploymentName
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PassThru

Writes true after the cancellation call returns without a terminating error. No value is written when -WhatIf or a declined confirmation skips cancellation.

Parameter properties

Type:SwitchParameter
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Profile

The AzClips profile to use instead of the active profile.

Parameter properties

Type:String
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Shows PowerShell's cancellation action message without sending a cancellation request. No -PassThru value is written.

Parameter properties

Type:SwitchParameter
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

Microsoft.Azure.Azclips.Extensions.Resources.Models.DeploymentExtended

Accepts a management-group deployment object from the pipeline.

Outputs

Boolean

No output by default. With -PassThru, writes true after the cancellation call returns. No value is written when -WhatIf or a declined confirmation skips cancellation.

Notes

Completed, failed, or canceled deployments cannot be canceled. The legacy -Pre and -AsJob switches are not supported.