Remove-AzPolicyRemediation
Deletes a policy remediation.
Syntax
DeleteBySubscriptionId (Default)
Remove-AzPolicyRemediation
-Name <String>
[-SubscriptionId <String>]
[-DefaultProfile <PSObject>]
[-AsJob]
[-AllowStop]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
DeleteByResourceGroup
Remove-AzPolicyRemediation
-Name <String>
-ResourceGroupName <String>
[-SubscriptionId <String>]
[-DefaultProfile <PSObject>]
[-AsJob]
[-AllowStop]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
DeleteByResourceId
Remove-AzPolicyRemediation
-ResourceId <String>
[-Name <String>]
[-DefaultProfile <PSObject>]
[-AsJob]
[-AllowStop]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
DeleteByScope
Remove-AzPolicyRemediation
-Name <String>
-Scope <String>
[-DefaultProfile <PSObject>]
[-AsJob]
[-AllowStop]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
DeleteByManagementGroup
Remove-AzPolicyRemediation
-Name <String>
-ManagementGroupId <String>
[-DefaultProfile <PSObject>]
[-AsJob]
[-AllowStop]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
DeleteViaIdentity
Remove-AzPolicyRemediation
-InputObject <IPolicyInsightsIdentity>
[-DefaultProfile <PSObject>]
[-AsJob]
[-AllowStop]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Remove-AzPolicyRemediation cmdlet deletes a policy remediation.
The remediation must be in a terminal state in order to be deleted.
However, this cmdlet has a switch that allows it to force a remediation to stop if it's still in progress and then will proceed to delete it.
Examples
Remove-AzPolicyRemediation -ResourceGroupName "myRG" -Name "remediation1"
This command deletes the remediation named 'remediation1' in resource group 'myRG'.
$remediation = Get-AzPolicyRemediation -ManagementGroupId "mg1" -Name "remediation1"
$remediation | Remove-AzPolicyRemediation -Confirm
This command deletes the remediation named 'remediation1' from management group 'mg1'.
A confirmation prompt will be presented before deleting the resource.
Remove-AzPolicyRemediation -ResourceGroupName "myRG" -Name "remediation1" -AllowStop
This command deletes the remediation named 'remediation1' in resource group 'myRG'.
If the remediation is in-progress it will be canceled before being deleted.
Parameters
-AllowStop
Allow the remediation to be canceled if it is in-progress.
Harmless if the remediation is already in a terminal state.
Without this switch, the cmdlet will throw an error if the remediation is not in a terminal state.
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
-AsJob
Run cmdlet in the background.
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
Identity Parameter
Type: Microsoft.Azure.PowerShell.Cmdlets.PolicyInsights.Models.IPolicyInsightsIdentity
Default value: None
Supports wildcards: False
DontShow: False
DeleteViaIdentity
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
DeleteByManagementGroup
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
DeleteBySubscriptionId
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
DeleteByResourceGroup
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
DeleteByScope
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
DeleteByManagementGroup
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-PassThru
Returns true when the command succeeds
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
DeleteByResourceGroup
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
DeleteByResourceId
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
DeleteByScope
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
DeleteBySubscriptionId
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
DeleteByResourceGroup
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 .
Microsoft.Azure.PowerShell.Cmdlets.PolicyInsights.Models.IPolicyInsightsIdentity
Outputs