In this Azure PowerShell article, we will discuss the syntax and usage of the Get-AzPolicyAssignment PowerShell cmdlet and along with that, we will also discuss the use of the Get-AzPolicyAssignment PowerShell command with an example.
Table of Contents
Get-AzPolicyAssignment
Get-AzPolicyAssignment is a very good Azure PowerShell command to retrieve the policy assignments.
Syntax
Below is the syntax of the Get-AzPolicyAssignment PowerShell command.
Get-AzPolicyAssignment
Get-AzPolicyAssignment
[-Name <String>]
[-Scope <String>]
Now, let’s discuss a few examples of how to use the Get-AzPolicyAssignment PowerShell command with a few examples.
Example
Below PowerShell command can help you to retrieve the lists of policy assignments.
Get-AzPolicyAssignment
After running the above command, I got the below output.
PS C:\WINDOWS\system32> Get-AzPolicyAssignment
Identity :
Location :
Name : SecurityCenterBuiltIn
ResourceId : /subscriptions/1cdf4300-dee5-4518-8c8c-feaa72a5ghd1/providers/Mic
rosoft.Authorization/policyAssignments/SecurityCenterBuiltIn
ResourceName : SecurityCenterBuiltIn
ResourceGroupName :
ResourceType : Microsoft.Authorization/policyAssignments
SubscriptionId : 1cdf4300-dee5-4518-8c8c-feaa72a5ghd1
Sku :
PolicyAssignmentId : /subscriptions/1cdf4300-dee5-4518-8c8c-feaa72a5ghd1/providers/Mic
rosoft.Authorization/policyAssignments/SecurityCenterBuiltIn
Properties : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.P
olicy.PsPolicyAssignmentProperties
You can see the same output here as below
