Edit

Get-AzPolicyRemediation

Gets policy remediations.

Syntax

ListBySubscriptionId (Default)

Get-AzPolicyRemediation
    [-SubscriptionId <String[]>]
    [-Filter <String>]
    [-Top <Int32>]
    [-DefaultProfile <PSObject>]
    [<CommonParameters>]

ListByResourceGroup

Get-AzPolicyRemediation
    -ResourceGroupName <String>
    [-SubscriptionId <String[]>]
    [-Filter <String>]
    [-Top <Int32>]
    [-DefaultProfile <PSObject>]
    [<CommonParameters>]

GetBySubscriptionId

Get-AzPolicyRemediation
    -Name <String>
    [-SubscriptionId <String[]>]
    [-Top <Int32>]
    [-IncludeDetail]
    [-DefaultProfile <PSObject>]
    [<CommonParameters>]

GetByResourceGroup

Get-AzPolicyRemediation
    -Name <String>
    -ResourceGroupName <String>
    [-SubscriptionId <String[]>]
    [-Top <Int32>]
    [-IncludeDetail]
    [-DefaultProfile <PSObject>]
    [<CommonParameters>]

GetByManagementGroup

Get-AzPolicyRemediation
    -ManagementGroupId <String>
    -Name <String>
    [-Top <Int32>]
    [-IncludeDetail]
    [-DefaultProfile <PSObject>]
    [<CommonParameters>]

ListByManagementGroup

Get-AzPolicyRemediation
    -ManagementGroupId <String>
    [-Filter <String>]
    [-Top <Int32>]
    [-DefaultProfile <PSObject>]
    [<CommonParameters>]

GetByResourceId

Get-AzPolicyRemediation
    -Name <String>
    -ResourceId <String>
    [-Top <Int32>]
    [-IncludeDetail]
    [-DefaultProfile <PSObject>]
    [<CommonParameters>]

GetByScope

Get-AzPolicyRemediation
    -Name <String>
    -Scope <String>
    [-Top <Int32>]
    [-IncludeDetail]
    [-DefaultProfile <PSObject>]
    [<CommonParameters>]

ListByScope

Get-AzPolicyRemediation
    -Scope <String>
    [-Filter <String>]
    [-Top <Int32>]
    [-DefaultProfile <PSObject>]
    [<CommonParameters>]

ListByResourceId

Get-AzPolicyRemediation
    -ResourceId <String>
    [-Filter <String>]
    [-Top <Int32>]
    [-DefaultProfile <PSObject>]
    [<CommonParameters>]

GetViaIdentity

Get-AzPolicyRemediation
    -InputObject <IPolicyInsightsIdentity>
    [-DefaultProfile <PSObject>]
    [<CommonParameters>]

Description

The Get-AzPolicyRemediation cmdlet gets all policy remediations in a scope or a particular remediation.

Examples

Example 1: Get all policy remediations in the current subscription

Get-AzPolicyRemediation

This command gets all the remediations created at or underneath the subscription in the current context.

Example 2: Get a specific policy remediation and the deployment details

Get-AzPolicyRemediation -ResourceGroupName "myResourceGroup" -Name "remediation1" -IncludeDetail

This command gets the remediation named 'remediation1' from resource group 'myResourceGroup'. The details of the deployments created by the remediation will be included.

Example 3: Get 10 policy remediations in a management group with optional filters

Get-AzPolicyRemediation -ManagementGroupId "mg1" -Top 10 -Filter "PolicyAssignmentId eq '/providers/Microsoft.Management/managementGroups/mg1/providers/Microsoft.Authorization/policyAssignments/pa1'"

This command gets a max of 10 policy remediations from a management group named 'mg1'. Only policy remediations for the given policy assignment will be retrieved.

Parameters

-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

-Filter

Filter expression using OData notation.

Parameter properties

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

Parameter sets

ListBySubscriptionId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ListByResourceGroup
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ListByManagementGroup
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ListByScope
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ListByResourceId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IncludeDetail

Include details of the deployments created by the remediation.

Parameter properties

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

Parameter sets

GetBySubscriptionId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
GetByResourceGroup
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
GetByManagementGroup
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
GetByResourceId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
GetByScope
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

GetViaIdentity
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

GetByManagementGroup
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ListByManagementGroup
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

GetBySubscriptionId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
GetByResourceGroup
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
GetByManagementGroup
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
GetByResourceId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
GetByScope
Position:Named
Mandatory:True
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

ListByResourceGroup
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
GetByResourceGroup
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 or remediations were made against.

Parameter properties

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

Parameter sets

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

-Scope

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

Parameter properties

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

Parameter sets

GetByScope
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ListByScope
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

ListBySubscriptionId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ListByResourceGroup
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
GetBySubscriptionId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
GetByResourceGroup
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Top

Maximum number of records to return. When IncludeDetail is specified, this parameter applies to the amount of deployments returned.

Parameter properties

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

Parameter sets

ListBySubscriptionId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ListByResourceGroup
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
GetBySubscriptionId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
GetByResourceGroup
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
GetByManagementGroup
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ListByManagementGroup
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
GetByResourceId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
GetByScope
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ListByScope
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ListByResourceId
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