Verify the connection of Exchange Online using username password

Abhishek Goyal 246 Reputation points
2023-05-24T09:28:18.81+00:00

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.
10,675 questions
0 comments No comments
{count} votes

Accepted answer
  1. Kael Yao-MSFT 37,496 Reputation points Microsoft Vendor
    2023-05-25T02:27:08.5833333+00:00

    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 | 
    foreach{
    	$Member = Get-RoleGroupMember $_.Name
    
    	new-object psobject -Property @{
    	GroupName = $_.Name
    	Membership = $Member
    	}
    }
    $Result
    

    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.


0 additional answers

Sort by: Most helpful