In this Azure PowerShell article, we will discuss the syntax and usage of the Get-AzRoleAssignment PowerShell cmdlet with a few examples.
Get-AzRoleAssignment
Get-AzRoleAssignment is an excellent Azure PowerShell cmdlet that can get you the lists of all the role assignments under your subscription or under a specific scope.
Syntax of Get-AzRoleAssignment
Below is the syntax of the Get-AzRoleAssignment Azure PowerShell cmdlet.
Get-AzRoleAssignment
Get-AzRoleAssignment
-SignInName <String>
Get-AzRoleAssignment
-ServicePrincipalName <String>
Get-AzRoleAssignment
-Scope
Let’s discuss some examples of implementation of the Get-AzRoleAssignment PowerShell command.
Example-1:
You can execute the below Azure PowerShell cmdlet that can help you to get the list of all the role assignments under my current subscription.
Get-AzRoleAssignment
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
rosoft.Authorization/roleAssignments/072ce967-2dc4-4b38-843b-6159
53b8198e
Scope : /subscriptions/1cdf4300-dee5-4518-8c8c-feaa72a5chj1
DisplayName : azureautomation_idrvaOiJqKr83hFze6OY2Yk7UCaDko7cZHPXeGjjGUo=
SignInName :
RoleDefinitionName : Contributor
RoleDefinitionId : b24988ac-6180-42a0-ab88-20f7382dd24c
ObjectId : 7f5ca3c4-4c26-4da6-a9fc-2f0d6adac4fb
ObjectType : ServicePrincipal
CanDelegate : False
Description :
ConditionVersion :
Condition :
You can see the output below

Example-2:
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"
Example-3:
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 below articles
Wrapping Up
In this Azure article, we have discussed the syntax and usage of the Get-AzRoleAssignment Azure PowerShell cmdlet. Thanks for reading this article !!!