Upravit

Sdílet prostřednictvím


Stop-AzPolicyRemediation

Cancels an in-progress policy remediation.

Syntax

Stop-AzPolicyRemediation
    -Name <String>
    [-Scope <String>]
    [-ManagementGroupName <String>]
    [-ResourceGroupName <String>]
    [-AsJob]
    [-PassThru]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]
Stop-AzPolicyRemediation
    -ResourceId <String>
    [-AsJob]
    [-PassThru]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]
Stop-AzPolicyRemediation
    -InputObject <PSRemediation>
    [-AsJob]
    [-PassThru]
    [-DefaultProfile <IAzureContextContainer>]
    [-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 cmdlet in the background.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

The Remediation object.

Type:PSRemediation
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ManagementGroupName

Management group ID.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Name

Resource name.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-PassThru

Return True if the command completes successfully.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ResourceGroupName

Resource group name.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ResourceId

Resource ID.

Type:String
Aliases:Id
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Scope

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

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

PSRemediation

Outputs

Boolean