Stop-AzResourceGroupDeployment
Cancel a currently running resource group deployment.
Syntax
Default (Default)
Stop-AzResourceGroupDeployment
[-ResourceGroupName] <string>
[-Name] <string>
[-SubscriptionId <string>]
[-Profile <string>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Cancels a running Azure Resource Manager deployment scoped to a resource group. A deployment can only be cancelled while its provisioning state is Accepted or Running; once cancelled the state becomes Canceled and the resource group is left partially deployed, so any resources the deployment already created remain and must be cleaned up separately. Cancelling a deployment that has already reached a terminal state fails with DeploymentCannotBeCancelled. The cmdlet emits nothing on success. The subscription defaults to the active profile's subscription unless -SubscriptionId is supplied.
Examples
Cancel a running deployment
Stop the in-flight deployment named infra-prod-2026-06-18 in resource group myrg.
Stop-AzResourceGroupDeployment -ResourceGroupName myrg -Name infra-prod-2026-06-18
Cancel a running deployment in a specific subscription
Target a subscription other than the active profile's.
Stop-AzResourceGroupDeployment -ResourceGroupName myrg -Name infra-prod-2026-06-18 -SubscriptionId 00000000-0000-0000-0000-000000000000
Cancel a deployment unattended
Stop-AzResourceGroupDeployment supports ShouldProcess with a Medium confirm impact, so it does not prompt under the default $ConfirmPreference of High. Pass -Confirm:$false to keep it silent even where $ConfirmPreference has been lowered, and inspect the resulting state afterwards.
Stop-AzResourceGroupDeployment -ResourceGroupName myrg -Name infra-prod-2026-06-18 -Confirm:$false
(Get-AzResourceGroupDeployment -ResourceGroupName myrg -Name infra-prod-2026-06-18).Properties.ProvisioningState
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 |
-Name
The name of the deployment to cancel.
Parameter properties
| Type: | String |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | DeploymentName |
Parameter sets
(All)
| Position: | 1 |
| Mandatory: | True |
| Value from pipeline: | False |
| Value from pipeline by property name: | True |
| Value from remaining arguments: | False |
-Profile
Use the named profile for this command, overriding 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 |
-ResourceGroupName
The name of the resource group that contains the deployment.
Parameter properties
| Type: | String |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | 0 |
| Mandatory: | True |
| Value from pipeline: | False |
| Value from pipeline by property name: | True |
| Value from remaining arguments: | False |
-SubscriptionId
Azure subscription id. Defaults to the active profile's subscription.
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
Runs the command in a mode that only reports what would happen without performing the actions.
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
String
You can pipe the ResourceGroupName and Name values to this cmdlet by property name, for example the output of Get-AzResourceGroupDeployment.
Outputs
Void
Nothing is emitted on success. Azure Resource Manager answers the cancel request with HTTP 204 No Content, so a silent return and a zero exit status mean the deployment was cancelled. Failures surface as terminating errors.
Notes
Only a deployment whose provisioning state is Accepted or Running can be cancelled. Cancelling stops the deployment where it stands and leaves the resource group partially deployed; resources already created are not rolled back. Use Get-AzResourceGroupDeployment to confirm the deployment reached the Canceled state.