Edit

Share via


Get-AzPolicyRemediation

Gets policy remediations.

Syntax

SubscriptionScope (Default)

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

ByName

Get-AzPolicyRemediation
    -Name <String>
    [-Scope <String>]
    [-ManagementGroupName <String>]
    [-ResourceGroupName <String>]
    [-Top <Int32>]
    [-IncludeDetail]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

GenericScope

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

ManagementGroupScope

Get-AzPolicyRemediation
    -ManagementGroupName <String>
    [-Top <Int32>]
    [-Filter <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ResourceGroupScope

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

ByResourceId

Get-AzPolicyRemediation
    -ResourceId <String>
    [-Top <Int32>]
    [-IncludeDetail]
    [-DefaultProfile <IAzureContextContainer>]
    [<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

Set-AzContext -Subscription "My Subscription"
Get-AzPolicyRemediation

This command gets all the remediations created at or underneath a subscription named 'My Subscription'.

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 resources being remediated will be included.

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

Get-AzPolicyRemediation -ManagementGroupName "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 credentials, account, tenant, and subscription used for communication with Azure.

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, 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

SubscriptionScope
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
GenericScope
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ManagementGroupScope
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ResourceGroupScope
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

ByName
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ByResourceId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ManagementGroupName

Management group ID.

Parameter properties

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

Parameter sets

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

-Name

Resource name.

Parameter properties

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

Parameter sets

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

-ResourceGroupName

Resource group name.

Parameter properties

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

Parameter sets

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

-ResourceId

Resource ID.

Parameter properties

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

Parameter sets

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

-Scope

Scope of the resource. For example, '/subscriptions/{subscriptionId}/resourceGroups/{rgName}'.

Parameter properties

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

Parameter sets

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

-Top

Maximum number of records to return.

Parameter properties

Type:Int32
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

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

Outputs

PSRemediation