how to connect to Azure or Exchange from a powershell script with an active MFA user?

Eduardo Martín Sanz 41 Reputation points
2024-08-30T07:28:47.4966667+00:00

Following the change to be made by microsoft in October where all users must have active MFA, I am reviewing the scripts I have to connect against Azure and Exchange and I would like to know if you can help me find the best way to carry out this connection, and assign the necessary roles to make changes at the level of Exchange and Entra ID.

Thank you all for your time

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
21,292 questions
0 comments No comments
{count} votes

Accepted answer
  1. Mike Hu-MSFT 3,120 Reputation points Microsoft Vendor
    2024-09-02T05:44:43.5033333+00:00

    Hi,

    Welcome to the Microsoft Q&A platform!

    Based on your description, when you connect to Exchange Online PowerShell with multi-factor authentication (MFA), you can use Connect-ExchangeOnline cmdlets, for example:

    Connect-ExchangeOnline -UserPrincipalName admin@contoso.onmicrosoft.com
    

    More information you can refer to:Connect to Exchange Online PowerShell

    And you can connect to Azure AD using this Command:

    Connect-AzureAD
    

    And I want to confirm with you what role assignment you are referring to? Are you looking for this Add-RoleGroupMember? Please point out for any misunderstanding!

    Please feel free to contact me for any updates. And if this helps, don't forget to mark it as an answer!

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.