In this Azure PowerShell article, we will discuss the syntax and usage of the Get-AzRoleAssignment PowerShell cmdlet with a few examples.
Get-AzRoleAssignment is an excellent Azure PowerShell cmdlet that can get you the lists of all the role assignments under your subscription or a specific scope.
Syntax of Get-AzRoleAssignment
Below is the syntax of the Get-AzRoleAssignment Azure PowerShell cmdlet.
Let’s discuss some examples of implementation of the Get-AzRoleAssignment PowerShell command.
You can execute the Azure PowerShell cmdlet below to help you get the list of all the role assignments under my current subscription.
After executing the above PowerShell command, I got the below output.
PS C:\Users\Bijay> Get-AzRoleAssignment
RoleAssignmentName : 072ce967-2dc4-4b38-843b-615953b8198e
RoleAssignmentId : /subscriptions/1cdf4300-dee5-4518-8c8c-feaa72a5chj1/providers/Mic
Scope : /subscriptions/1cdf4300-dee5-4518-8c8c-feaa72a5chj1
DisplayName : azureautomation_idrvaOiJqKr83hFze6OY2Yk7UCaDko7cZHPXeGjjGUo=
RoleDefinitionName : Contributor
RoleDefinitionId : b24988ac-6180-42a0-ab88-20f7382dd24c
ObjectId : 7f5ca3c4-4c26-4da6-a9fc-2f0d6adac4fb
ObjectType : ServicePrincipal
CanDelegate : False
You can see the output below
You can also use the below Azure PowerShell command to get the list of role assignments under the specified service principal “http://tsinfotechnologies.com”.
Get-AzRoleAssignment -ServicePrincipalName "http://tsinfotechnologies.com"
Execute the below PowerShell command that can help you to get the list of role assignments under a specified tsinfo website scope.
Get-AzRoleAssignment -Scope "/subscriptions/1cdf4300-dee5-4518-8c8c-feaa72a5chj1/resourcegroups/myrsg/providers/Microsoft.Web/sites/tsinfo"
You may also like following the articles below
In this Azure article, we have discussed the syntax and usage of the Get-AzRoleAssignment Azure PowerShell cmdlet. Thanks for reading this article !!!
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.