简体   繁体   中英

Issues connecting to Microsoft Exchange online using PowerShell - app only authentication

I could not connect to Exchange Online, I get the below error while connecting

Error Acquiring Token: System.Exception: In the case of a Federated user(that is owned by a federated IdP, as opposed to a managed user owned in an Azure AD tenant) ID3242: The security token could not be authenticated or authorized.The user does not exist or has entered the wrong pas swordInnerException: Federated service

PowerShell Code

$AppCredential= New-Object System.Management.Automation.PSCredential(<UPN>,<Token>)

Connect-ExchangeOnline -Credential $AppCredential

Reference

https://o365reports.com/2020/07/04/modern-auth-and-unattended-scripts-in-exchange-online-powershell-v2/

Connect to Exchange Online using App-only authentication Feature is not available in EXO V2 .

Delegation is not possible with app-only authentication. The Secure App Model allows for unattended scripting in delegation scenarios.

Delegation is not supported in this Feature.

Note: Decrease your EXO V2 into V1 then you can use the same scripts to connect the Exchange Online using APP-only Authentication. . But This way is not recommended.

Refer here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM