MFA enabled account Exchange Online Powershell automation with tokens

Nikita Krivets 486 Reputation points


I was told to put my question here. Just in case here is the link for my previous question.

I need to automate my Exchange Online Powershell Tasks using an MFA enabled user account.

Firstly, I entered my credentials and proceed with MFA to get an Access Token and a Refresh Token. Secondly, I opened my Exchange Online Powershell session ( with the Access Token as a password for my * Email address is removed for privacy *. Now the session is established. Next time I want to open a session, I am to use my previously acquired Refresh Token to get a new Access Token and so on.

Is it a proper way to automate my tasks?

Thanks in advance.

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,184 questions
{count} votes

Accepted answer
  1. FrankHu-MSFT 976 Reputation points

    I see, so you want to consistently refresh the token? Unfortunately this is not supported, per the github issue here :

    If you're interested in this feature, I suggest submitting an issue against here :

    And if there's enough community support the product team will look into implementing this feature accordingly. Thanks for your feedback!

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful