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.
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
Get-AzPolicyAssignment – Video Tutorial
Check out a video tutorial on this command.
Conclusion
In this Azure article, we discussed, the syntax and usage of the Get-AzPolicyAssignment PowerShell cmdlet and along with certain examples of how to use this command.
I am Rajkishore, and I have over 14 years of experience in Microsoft Azure and AWS, with good experience in Azure Functions, Storage, Virtual Machine, Logic Apps, PowerShell Commands, CLI Commands, Machine Learning, AI, Azure Cognitive Services, DevOps, etc. Not only that, I do have good real-time experience in designing and developing cloud-native data integrations on Azure or AWS, etc. I hope you will learn from these practical Azure tutorials. Read more.