Forum Discussion
venkatchandra2024
Aug 13, 2024Copper Contributor
need help on list of Azure entra id groups associated for the appid / registered application
I need to write a script to list groups associated with application using PowerShell , please help
- Aug 15, 2024
Hello againvenkatchandra2024 !
If you run the following instead then you will get the Name of the group or user that is assigned to the application in a nice list 🙂
Connect-MgGraph -Scope "Application.Read.All" $ServicePrincipalId = "<YourEnterpriseAppObjectID>" Get-MgServicePrincipalAppRoleAssignedTo -ServicePrincipalId $ServicePrincipalId | select PrincipalDisplayName, PrincipalTypeSo all you need to edit is the last command. And your output will look like this
Let me know how it goes!
Kind Regards
Oliwer Sundgren
venkatchandra2024
Aug 14, 2024Copper Contributor
Thank you for the response this query returning result witth PrincipleId and Princle type, I want group names for an application , removed retuned data
DeletedDateTime Id AppRoleId CreatedDateTime PrincipalDisplayName PrincipalId PrincipalType
--------------- -- --------- --------------- -------------------- ----------- -------------
DeletedDateTime Id AppRoleId CreatedDateTime PrincipalDisplayName PrincipalId PrincipalType
--------------- -- --------- --------------- -------------------- ----------- -------------
oliwer_sundgren
Aug 15, 2024Iron Contributor
Hello againvenkatchandra2024 !
If you run the following instead then you will get the Name of the group or user that is assigned to the application in a nice list 🙂
Connect-MgGraph -Scope "Application.Read.All"
$ServicePrincipalId = "<YourEnterpriseAppObjectID>"
Get-MgServicePrincipalAppRoleAssignedTo -ServicePrincipalId $ServicePrincipalId | select PrincipalDisplayName, PrincipalType
So all you need to edit is the last command. And your output will look like this
Let me know how it goes!
Kind Regards
Oliwer Sundgren
- venkatchandra2024Aug 15, 2024Copper ContributorThank you for the response, Can I pass Appname instedy of $ServicePrincipalId = "<YourEnterpriseAppObjectID>"
Connect-MgGraph -Scope "Application.Read.All"
$appName= "<YourEnterpriseAppObjectID>"
Get-MgServicePrincipalAppRoleAssignedTo -ServicePrincipalId $ServicePrincipalId | select PrincipalDisplayName, PrincipalType