In our python application, we use the Exchange Management Shell cmdlets to perform some tasks. (In fact, the python application runs .Net application, which calls the Exchange Management Shell cmdlets.) Currently we use basic authentication with the New-PSSession cmdlet. On the other hand, we are already acquiring OAuth2 access tokens for different APIs and resources. Now we would like to use OAuth2 authentication with the Exchange Management Shell cmdlets.
We had a look at this article[1].
However we have a few questions:
Oh, in fact, everything is very simple:
https://login.microsoftonline.com/common/oauth2/authorize?redirect_uri=http%3A%2F%2Flocalhost%3A55555&client_id=a0c73c16-a7e3-4564-9a95-2bdf47383716&response_type=code
Request for an access token:
https://login.microsoftonline.com/common/oauth2/token
resource=https%3A%2F%2Foutlook.office365.com&client_id=a0c73c16-a7e3-4564-9a95-2bdf47383716&redirect_uri=http%3A%2F%2Flocalhost%3A9999&code=YOUR_AUTHORIZATION_CODE&client_secret=&grant_type=authorization_code