Nick N
Nick N

Reputation: 21

Is is possible to connect to exchange powershell online using azure-AD app ID/secret?

Is it possible to connect to exchange powershell online using registered Azure application ID/secret which allows GraphAPI/EWS access?

FYI, I know how to do it with basic auth (username/password) as guided in MSFT website: https://learn.microsoft.com/en-us/powershell/exchange/exchange-online/connect-to-exchange-online-powershell/connect-to-exchange-online-powershell?view=exchange-ps

Upvotes: 2

Views: 3438

Answers (2)

user11383578
user11383578

Reputation:

I'd suggest try EXO V2 preview module to connect Exchange Online PowerShell using registered Azure application.

Step1: Get an OAuth access token using Active Directory Authentication Library (ADAL) PowerShell.

Step2: Create PSCredential object

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

Step3: Pass the PSCredential to the EXO V2 module.

Connect-ExchangeOnline -Credential $AppCredential

Upvotes: 0

Frank H
Frank H

Reputation: 871

it is currently possible to use the Microsoft Graph API to make calls to the exchange endpoint. However it's not the same thing as Exchange Powershell Online, please refer to the docs on the exchange graph api here : https://learn.microsoft.com/en-us/exchange/client-developer/exchange-web-services/office-365-rest-apis-for-mail-calendars-and-contacts

For more information on how to make calls via powershell, please look here : https://blogs.technet.microsoft.com/cloudlojik/2018/06/29/connecting-to-microsoft-graph-with-a-native-app-using-powershell/

You will also need to login with a user that has access to said exchange resources. If you login with an application/user that does not have permissions to access the exchange resources you will get a access denied error.

Upvotes: 1

Related Questions