The Adaxes tutorials error out, and I am not sure if Adaxes has permissions to run commands on 365.
Please, clarify what you mean by tutorials error out. If you face any errors, please, post here or send us (support[at]softerra.com) screenshots of the errors and specify where you face them.
However the script errors with "Connecting to the remote server outlook.office365.com failed with the following error message: Access is denied".
Please, make sure the account used to register your Office 365 tenant in Adaxes is assigned to either the Global Administrator or both the User Management Administrator and Exchange Administrator roles in Office 365. To check/change the account:
- Launch Adaxes Administration Console.
- In the Console Tree, expand your service node.
- Navigate to Configuration/Cloud Services and select Office 365.
- In the Result Pane on the right, select the Office 365 tenant.
- Click Edit.
- Activate the Admin Account tab. The account username will be displayed in the corresponding field below.
If the account is assigned to either of the roles, please, check whether the Basic authentication is enabled in Exchange Online for the account. If it is disabled, to connect to Exchange Online you need to use a different approach. For an example of the script that connects to Exchange Online using the approach, have a look at the Exchange Online using EXO V2 module script on the following repository page: https://www.adaxes.com/script-repository/connect-to-exchange-with-powershell-s506.htm. Important: to use the script, install the EXO V2 PowerShell module on the computer where Adaxes service is running.
I presume it is having problems with this - $Context.GetOffice365Credential() But I do not know how to tell what this function is calling or pointing at. I don't know if it's trying to use the Adaxes service account, or the ADsync account.
The $Context.GetOffice365Credential method returns credentials of the account used to register an Office 365 tenant in Adaxes that is associated with the object for which the script is executed.