Bearbeiten

Freigeben über


Get-AzPolicyExemption

Gets policy exemptions.

Syntax

Get-AzPolicyExemption
   [-Name <String>]
   [-Scope <String>]
   [-PolicyAssignmentIdFilter <String>]
   [-BackwardCompatible]
   [-DefaultProfile <PSObject>]
   [<CommonParameters>]
Get-AzPolicyExemption
   [-Scope <String>]
   [-IncludeDescendent]
   [-BackwardCompatible]
   [-DefaultProfile <PSObject>]
   [<CommonParameters>]
Get-AzPolicyExemption
   [-PolicyAssignmentIdFilter <String>]
   -Id <String>
   [-BackwardCompatible]
   [-DefaultProfile <PSObject>]
   [<CommonParameters>]

Description

The Get-AzPolicyExemption cmdlet gets a collection of policy exemptions or a specific policy exemption identified by name or ID.

Examples

Example 1 Get all policy exemptions

Get-AzPolicyExemption

This command gets all the policy exemptions in the current subscription. If you need to list all the exemptions related to the given scope, including those from ancestor scopes and those from descendent scopes you need to pass the -IncludeDescendent parameter.

Example 2: Get a specific policy exemption

$ResourceGroup = Get-AzResourceGroup -Name 'ResourceGroup11'
Get-AzPolicyExemption -Name 'PolicyExemption07' -Scope $ResourceGroup.ResourceId

The first command gets a resource group named ResourceGroup11 by using the Get-AzResourceGroup cmdlet and stores it in the $ResourceGroup variable. The second command gets the policy exemption named PolicyExemption07 for the scope that the ResourceId property of $ResourceGroup identifies.

Example 3: Get all policy exemptions associated with a policy assignment

$Assignment = Get-AzPolicyAssignment -Name 'PolicyAssignment07'
Get-AzPolicyExemption -PolicyAssignmentIdFilter $Assignment.ResourceId

The first command gets a policy assignment named PolicyAssignment07. The second command gets all of the policy exemptions that are assigned with the policy assignment.

Parameters

-BackwardCompatible

Causes cmdlet to return artifacts using legacy format placing policy-specific properties in a property bag object.

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

-DefaultProfile

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

Type:PSObject
Aliases:AzureRMContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Id

The fully qualified resource Id of the exemption.

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

-IncludeDescendent

Causes the list of returned policy exemptions to include all exemptions related to the given scope, including those from ancestor scopes and those from descendent scopes. If not provided, only exemptions at and above the given scope are included.

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

-Name

The name of the policy exemption.

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

-PolicyAssignmentIdFilter

The policy assignment id filter.

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

-Scope

The scope of the policy exemption. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'

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

Inputs

SwitchParameter

String

Outputs

IPolicyExemption