How can I get the Owner and the 'Users and Group' assigned to the Enterprise Application or Service principal

EnterpriseArchitect 4,916 Reputation points
2024-01-30T06:26:30.63+00:00

Using PowerShell Microsoft Graph, how can I get/retrieve the list of Owners and the 'Users and Group' assigned to the Enterprise Application or Service principal? Screenshot 2024-01-30 165151

Screenshot 2024-01-30 165117

When I tried using the below cmdlet, it threw an error about the object cannot be found.

$AppDisplayName = 'WunderList'
$ApplicationID = 'GUID'$ObjectID = 'GUID'
Get-MgApplicationOwner -ApplicationId $ApplicationID
Get-MgApplicationOwnerByRef -ApplicationId $ApplicationID
Get-MgApplicationOwnerAsUser -ApplicationId $ApplicationID
Get-MgApplicationOwnerAsUser -ApplicationId $ApplicationID -DirectoryObjectId $ObjectID -Property *
Get-MgApplicationOwnerAsAppRoleAssignment -ApplicationId $ApplicationID
Get-MgApplicationOwnerAsAppRoleAssignment -ApplicationId $ApplicationID -DirectoryObjectId $ObjectID

I really appreciate any help you can provide.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,984 questions
Active Directory Federation Services
Active Directory Federation Services
An Active Directory technology that provides single-sign-on functionality by securely sharing digital identity and entitlement rights across security and enterprise boundaries.
1,213 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,205 questions
Microsoft Entra
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,004 questions
0 comments No comments
{count} votes

Accepted answer
  1. Harpreet Singh Matharoo 7,586 Reputation points Microsoft Employee
    2024-01-30T10:27:45.6066667+00:00

    Hello @EnterpriseArchitect

    Thank you for contacting Microsoft Azure QnA platform. I would like to share following commands which can be helpful to get the details you are looking for:

    {$applicationId = App-Registration-ObjectID; $servicePrincipalId = Service-Principal-ObjectID}

    Microsoft Graph PowerShell Commands:

    • Get-MgBetaApplicationOwner -ApplicationId $applicationId
    • Get-MgBetaServicePrincipalAppRoleAssignedTo -ServicePrincipalId $servicePrincipalId
    • Get-MgBetaServicePrincipalOwner -ServicePrincipalId $servicePrincipalId

    Microsoft Graph API Query:

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful