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.
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
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.
The DefaultProfile parameter is not functional.
Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
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.
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}'
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.
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.