Sep 12 2022 12:21 AM
Currently we use EXO V1 module for unattended scripting in delegation scenarios.
We use refresh tokens to create a session via the following commands -
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid?BasicAuthToOAuthConversion=true" -Credential $credential -Authentication Basic -AllowRedirection
The refresh token is obtained by making a POST call to https://login.microsoftonline.com/[azure_tenant_id]/oauth2/v2.0/token with clientID and clientSecret.
Since the support for EXO V1 with basic Authentication will be deprecated starting October 2022, we want to move to EXO V2 module. We went through the documentation of EXO V2 module and did not find anyway how unattended scripting in delegation scenarios are supported.
Could you help us how we could use unattended scripting in delegation scenarios for Exchange Online Powershell EXO V2 module?
Sep 12 2022 08:50 AM
Sep 13 2022 01:59 AM - edited Sep 13 2022 03:21 AM
Thanks @Vasil Michev
We use Secure app model as documented in https://docs.microsoft.com/en-us/powershell/partnercenter/multi-factor-auth?view=partnercenterps-3.0...
However the refresh token is fetched via the API
https://login.microsoftonline.com/[azure_tenant_id]/oauth2/v2.0/token
Here clientID and clientSecrets are the azure application secretId and value. This is the application which is in a different account and has the delegated access
We will checks and evaluate the latest preview version which gets rid of WinRm if that works for us.
Thank you.
Regards,
Megaraj
Sep 13 2022 08:48 AM
Sep 14 2022 03:57 AM
Thanks @Vasil Michev
I was trying to use the preview version of EXO v2 servlet. I was not able to use it with unattended scripting for partner/delegation scenarios. Is there a document that describes this use-case?
I tried with the parameter -DelegatedOrganization parameter, however this opens up a web page for sign-in. I tried by suppling the -Credential parameter where the credential is the refresh OAuth token and this also errors out.
Could you please help us out here?
Sep 14 2022 08:13 AM