Hi Karina,
In my case, I used the package named UiPath.MicrosoftOffice365.Activities where you can do the connection more efficiently and dynamically.
Because you can type the Application ID and Tenant ID of Azure at the Microsoft Office 365 Scope .
Finally, you can use get credential to connect it.
Example:
Connection:
Package:

