The Get-AzPolicyEnrollment cmdlet gets a collection of policy enrollments or a specific policy enrollment identified by name or ID.
Examples
Example 1: Get all policy enrollments
Get-AzPolicyEnrollment
This command gets all the policy enrollments in the current subscription.
If you need to list all enrollments related to the given scope, including those from ancestor scopes and those from descendant scopes, pass the -IncludeDescendent parameter.
Example 2: Get a specific policy enrollment by name and scope
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 enrollment named PolicyEnrollment07 for the scope that the ResourceId property of $ResourceGroup identifies.
Example 3: Get all policy enrollments at management group scope
The first command gets a management group named AManagementGroup by using the Get-AzManagementGroup cmdlet and stores it in the $ManagementGroup variable.
The second command gets all policy enrollments at the management group scope identified by the Name property of $ManagementGroup.
Parameters
-DefaultProfile
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 enrollments to include all policy enrollments related to the given scope, including those from ancestor scopes and those from descendent scopes.
If not provided, only policy enrollments at and above the given scope are included.
The scope of the policy enrollment.
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.