Edit

Stop-AzPolicyRemediation

Cancels an in-progress policy remediation.

Syntax

CancelBySubscriptionId (Default)

Stop-AzPolicyRemediation
    -Name <String>
    [-SubscriptionId <String>]
    [-DefaultProfile <PSObject>]
    [-AsJob]
    [-NoWait]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

CancelByResourceGroup

Stop-AzPolicyRemediation
    -Name <String>
    -ResourceGroupName <String>
    [-SubscriptionId <String>]
    [-DefaultProfile <PSObject>]
    [-AsJob]
    [-NoWait]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

CancelByResourceId

Stop-AzPolicyRemediation
    -ResourceId <String>
    [-Name <String>]
    [-DefaultProfile <PSObject>]
    [-AsJob]
    [-NoWait]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

CancelByScope

Stop-AzPolicyRemediation
    -Name <String>
    -Scope <String>
    [-DefaultProfile <PSObject>]
    [-AsJob]
    [-NoWait]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

CancelByManagementGroup

Stop-AzPolicyRemediation
    -Name <String>
    -ManagementGroupId <String>
    [-DefaultProfile <PSObject>]
    [-AsJob]
    [-NoWait]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

CancelViaIdentity

Stop-AzPolicyRemediation
    -InputObject <IPolicyInsightsIdentity>
    [-DefaultProfile <PSObject>]
    [-AsJob]
    [-NoWait]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Stop-AzPolicyRemediation cmdlet cancels an in-progress policy remediation.

Active deployments will be canceled and no new deployments will be created.

Examples

Example 1: Cancel a policy remediation at resource group scope

Stop-AzPolicyRemediation -ResourceGroupName "myRG" -Name "remediation1"

This command cancels the remediation named 'remediation1' in resource group 'myRG'.

Example 2: Cancel a management group remediation via piping

$remediation = Get-AzPolicyRemediation -ManagementGroupName "mg1" -Name "remediation1"
$remediation | Stop-AzPolicyRemediation

This command cancels the remediation named 'remediation1' in management group 'mg1'.

Parameters

-AsJob

Run the command as a job.

Parameter properties

Type:SwitchParameter
Default value:None
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

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
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

-DefaultProfile

The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.

Parameter properties

Type:PSObject
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzureRMContext, AzureCredential

Parameter sets

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

-InputObject

Identity Parameter

Parameter properties

Type:Microsoft.Azure.PowerShell.Cmdlets.PolicyInsights.Models.IPolicyInsightsIdentity
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

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

-ManagementGroupId

Management group ID.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:ManagementGroupName

Parameter sets

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

-Name

The name of the remediation.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:RemediationName

Parameter sets

CancelBySubscriptionId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
CancelByResourceGroup
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
CancelByScope
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
CancelByManagementGroup
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-NoWait

Run the command asynchronously

Parameter properties

Type:SwitchParameter
Default value:None
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

Resource group name.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

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

-ResourceId

ID of the resource that the remediation was made for or full Resource ID of the remediation.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

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

-Scope

Scope of the resource. E.g. '/subscriptions/{subscriptionId}/resourceGroups/{rgName}'.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

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

-SubscriptionId

The ID of the target subscription. Uses current subscription if one isn't provided.

Parameter properties

Type:String
Default value:(Get-AzContext).Subscription.Id
Supports wildcards:False
DontShow:False

Parameter sets

CancelBySubscriptionId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
CancelByResourceGroup
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:None
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.PowerShell.Cmdlets.PolicyInsights.Models.IPolicyInsightsIdentity

Outputs

Microsoft.Azure.PowerShell.Cmdlets.PolicyInsights.Models.IRemediation