Verify the connection of Exchange Online using username password

Abhishek Goyal 131 Reputation points

My requirement is that I want to verify whether the user is an exchange administrator or not.

I have the username and password of that user.

Is there any API for that? I went through various docs but I didn't get any useful information.

For example - I give a username and password on UI and we verify it there and use it in the backend for exchange online operations.

Appreciate your efforts. Thanks in advance.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
1,302 questions
Microsoft Graph Azure AD API
Microsoft Graph Azure AD API
A Microsoft API that queries the user's profile, finds other users, manages organizational relationships, tracks assignments, or creates original solutions that incorporate existing organizational data.
252 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Kael Yao-MSFT 26,391 Reputation points Microsoft Vendor

    Hi @Abhishek Goyal,

    To me you can first export all current Exchange admin groups and memberships with an admin account and then have a check if this user is a member of these groups.

    You can run a script like the following example in Exchange Online Powershell to get the membership of Exchange admin groups:

    $Result = Get-RoleGroup | 
    	$Member = Get-RoleGroupMember $_.Name
    	new-object psobject -Property @{
    	GroupName = $_.Name
    	Membership = $Member

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.