I need to connect to Exchange Online using specific service principal, but I am getting error image.png

I am trying to authenticate via Connect-ExchangeOnline -AccessToken $token -Organization $organization

We have latest Adaxes version installed btw aka 3.8.0 version of the ExchangeOnlineManagement module is used automatically.

ago by (1.0k points)

1 Answer

ago by (307k points)
0 votes

Hello,

Unfortunately, there is no such possibility. Using method $Context.CloudServices.ConnectExchangeOnline() is the only option in Adaxes scripts. However, thank you for the suggestion. We forwarded it to the corresponding department for consideration.

ago by (1.0k points)
0

So it means I have to grant required permissions to service account running Adaxes service?

ago by (307k points)
+1

Hello,

The Adaxes service account (specified during Adaxes installation) does not take any part in establishing the connection to Exchange Online. The credentials of the user or application account specified for your Microsoft 365 tenant. For details on how to check/change the credentials, see https://www.adaxes.com/help/ChangeTenantServiceAccount. No matter which of the two is used, they were granted most of the usually required permissions for the Microsoft 365 tenant registration in Adaxes.

ago by (1.0k points)
0

OK, I have added permission Exchange.ManageAsAppV2 and one of the EXO Roles to the tenant service principal, but when invoking $Context.CloudServices.ConnectExchangeOnline() inside the adaxes report code I get error image.png

Is there anything else what needs to be done to have this working?

Thanks

ago by (307k points)
0

Hello,

Are you executing your script in a report? If so, the method must have a parameter. For details, see https://adaxes.com/sdk/ReportCloudServicesScriptContextClass/#ConnectExchangeOnline_details.

ago by (1.0k points)
0

I see.

OK I have customized the code to look like this image.png

and now I am getting following error image.png

$targetDN should be DN of the user specified in the parameter picker, so not sure what is wrong now

ago by (307k points)
0

Hello,

Do you have your Microsoft 365 tenant registered in Adaxe with the credentials of a user account? If that is correct, the error is expected and is on the Microsoft side. To resolve the issue, change the tenant registration in Adaxes to a Microsoft Entra app. The following article will be helpful: https://www.adaxes.com/help/RegisterAdaxesAsAppMicrosoftAzure.

Related questions

I'd like to run code against the Adaxes service but need to pass my Admin credentials. How do I send different creds than the current user?

asked Jul 27, 2020 by ComputerHabit (810 points)
0 votes
1 answer

The script create two reports of inactive workstation operating systems. The report is too detailed to run from one of the adaxes reports. Basically how can I set the script up to ... sure How I did this but I can't find it now (probably something simple).

asked Nov 30, 2022 by mightycabal (1.2k points)
0 votes
1 answer

How do I setup Adaxes for Exchange Online Hybrid mode? When I look at one of the users that has been migrated to Exchange Online I get the message of The operation couldn't be performed because object couldn't be found on domain controller.

asked Dec 5, 2019 by Lucas.Miller (20 points)
0 votes
1 answer

Hi, In the SDK I find information on how to use Powershell to read and create scripts in custom commands and business rules, but I can not find the same for ... information like the embedded scripts for the report and custom columns? -- Morten A. Steien

asked Jul 27, 2023 by Morten A. Steien (300 points)
0 votes
1 answer

The checkbox is not selected (False) by default.

asked May 30, 2022 by john.harding (70 points)
0 votes
1 answer