SOLVED

Is there any API to get organizational role of user of office 365 admin center?

%3CLINGO-SUB%20id%3D%22lingo-sub-1683101%22%20slang%3D%22en-US%22%3EIs%20there%20any%20API%20to%20get%20organizational%20role%20of%20user%20of%20office%20365%20admin%20center%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1683101%22%20slang%3D%22en-US%22%3E%3CP%3EIs%20there%20any%20API%20using%20which%20I%20can%20get%20the%20office%20365%20role%20of%20the%20user%3F%20If%20yes%20can%20someone%20help%20me%20with%20it%3F%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22sunnykalola_0-1600423600693.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F219496iC23CE2E9A08A3867%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22sunnykalola_0-1600423600693.png%22%20alt%3D%22sunnykalola_0-1600423600693.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EI%20want%20to%20get%20the%20user%20roles%20shown%20in%20the%20above%20screenshot%20using%20an%20API%20call%3F%20Can%20someone%20help%20me%20with%20it%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1683101%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAdministrator%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Emicrosoft%20teams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1684767%22%20slang%3D%22en-US%22%3ERe%3A%20Is%20there%20any%20API%20to%20get%20organizational%20role%20of%20user%20of%20office%20365%20admin%20center%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1684767%22%20slang%3D%22en-US%22%3E%3CP%3EYou%20can%20get%20this%20via%20the%20good%20old%20Get-MsolUserRole%20cmdlet.%20There's%20no%20direct%20replacement%20in%20the%20Azure%20AD%20PowerShell%20module%20or%20the%20Graph%20API%2C%20afaik.%20If%20using%20those%2C%20you'll%20have%20to%20enumerate%20membership%20of%20all%20directoryRoles.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Contributor

Is there any API using which I can get the office 365 role of the user? If yes can someone help me with it?

sunnykalola_0-1600423600693.png

I want to get the user roles shown in the above screenshot using an API call? Can someone help me with it?

1 Reply
Highlighted
Best Response confirmed by ThereseSolimeno (Microsoft)
Solution

You can get this via the good old Get-MsolUserRole cmdlet. There's no direct replacement in the Azure AD PowerShell module or the Graph API, afaik. If using those, you'll have to enumerate membership of all directoryRoles.