Skip to main content
Question

Microsoft 365 Excel Connection Error

  • Aug 11, 2026 9:05 AM UTC
  • 1 reply
  • 50 views

I'm trying to use the Microsoft 365 Excel - Connect action with a Control Room managed OAuth 2.0 connection in Automation Anywhere Cloud.

Environment

  • OAuth Authentication Mode: Control Room managed
  • Grant Type: Authorization Code Flow
  • Shared token successfully generated
  • Delegated Microsoft Graph permissions granted and admin consented:
    • User.Read
    • Files.ReadWrite.All
    • Sites.ReadWrite.All
    • Mail.ReadWrite
    • Mail.Send
    • offline_access
    • openid
    • profile

What works

  • OAuth connection tests successfully in Control Room.
  • Microsoft 365 Outlook Connect works successfully using the same connection and account.
  • The service account can access Outlook, SharePoint and OneDrive directly through Microsoft 365 in a browser on virtual machine

What doesn't work

The following actions fail immediately on the Connect action:

  • Microsoft 365 Excel: Connect
  • Microsoft 365 OneDrive: Connect
  • Microsoft 365 Calendar: Connect

Error:

We are unable to authorize the application with provided credentials. Please check your credentials and try again.

The error occurs before attempting to access any workbook, file or folder.

 

Question

Has anyone seen a situation where:

  • Outlook Connect works,
  • OAuth connection tests successfully,
  • but M365 Excel and OneDrive Connect actions all fail with an authorization error?

Could this be related to additional Graph permissions, package versions, or a known issue with the Microsoft 365 Excel/OneDrive packages?

Any suggestions would be appreciated.

Thanks!

1 reply

Forum|alt.badge.img
  • Automation Anywhere Team
  • Oct 15, 2026 2:21 PM UTC

🔴 Root Cause 1: Missing Required OAuth Scopes (Most Likely)

Despite having Files.ReadWrite.All and Sites.ReadWrite.All in your list, the M365 Excel and OneDrive Connect actions specifically require the following scopes to be present in the OAuth token:

Required Scopes per Package:

Package Required Scopes
M365 Excel Files.ReadWrite.All, offline_access, openid, profile, User.Read
M365 OneDrive Files.ReadWrite.All, offline_access, openid, profile, User.Read
M365 Calendar Calendars.ReadWrite, offline_access, openid, profile, User.Read

⚠️ Critical Finding: Your current scope list is missing Calendars.ReadWrite — this alone would explain why Calendar Connect fails. For Excel and OneDrive, the scopes appear present, but see Root Cause 2 below.

Action: Add Calendars.ReadWrite to your Azure AD app's delegated permissions and grant admin consent. Then regenerate the shared token in Control Room.

 

🔴 Root Cause 2: OneDrive Not Provisioned for the Service Account (Very Common)

This is the #1 most common cause of Excel/OneDrive Connect failures when Outlook works fine:

The service account's OneDrive has never been provisioned/initialized in Microsoft 365.

The M365 Excel and OneDrive packages call /me/drive as their first API call during Connect. If the service account has never logged into OneDrive or had its OneDrive provisioned by an admin, Microsoft Graph returns a 403 or 404 which the AA package translates into "We are unable to authorize the application with provided credentials."

This is NOT an OAuth/permission problem — it's a OneDrive provisioning problem.

How to verify:

  1. Log into the Microsoft 365 portal with the service account.
  2. Navigate to OneDrive (https://portal.office.com → OneDrive).
  3. If it shows a "Getting your OneDrive ready" message or is empty/uninitialized — this is your root cause.

Fix:

  • Have an M365 admin provision OneDrive for the service account via:
    • PowerShell: Request-SPOPersonalSite -UserEmails @("serviceaccount@domain.com")
    • Or simply have the service account log into OneDrive once via a browser to trigger provisioning.
  • Wait 5–15 minutes for provisioning to complete, then retry the Connect action.

 

🔴 Root Cause 3: OAuth Token Scope Mismatch – Token Was Generated BEFORE Scopes Were Added

This is another very common issue with Control Room managed OAuth:

The shared token was generated before all required scopes were added to the Azure AD app registration. The existing token does NOT automatically include newly added scopes.

Even if you added Files.ReadWrite.All and Sites.ReadWrite.All to the Azure AD app registration after the initial token was generated, the existing shared token in Control Room only contains the scopes that were present at the time it was generated.

Fix:

  1. Go to Control Room → Credentials → OAuth Connections.
  2. Delete/revoke the existing shared token.
  3. Re-authenticate to generate a new token — this will include all currently configured scopes.
  4. Retry the Connect actions.

 

🔴 Root Cause 4: Authorization Code Flow – Token Tied to Specific User Context

With Authorization Code Flow (delegated permissions), the token is tied to the specific user who authenticated. If:

  • The user who generated the shared token does not have a OneDrive license assigned.
  • The user has Exchange Online (Outlook) but not a SharePoint/OneDrive license.

Then Outlook works (Exchange Online license present) but OneDrive/Excel/Calendar fail (SharePoint/OneDrive license missing or Calendar not enabled).

Check: In Microsoft 365 Admin Center → Users → Service Account → Licenses and Apps — verify that SharePoint Online, OneDrive for Business, and Exchange Online are all enabled for this account.

 

🟡 Root Cause 5: Package Version Compatibility

There have been known issues with specific versions of the M365 Excel and OneDrive packages where the Connect action fails with authorization errors due to changes in the Microsoft Graph API response format.

Action:

 

✅ Recommended Action Plan (Priority Order)

Priority Action
🥇 1 Verify OneDrive is provisioned for the service account — log in via browser to https://portal.office.com/onedrive
🥈 2 Add Calendars.ReadWrite to Azure AD app delegated permissions → grant admin consent
🥉 3 Revoke and regenerate the shared token in Control Room to pick up all current scopes
4 Verify M365 licenses — confirm SharePoint Online + OneDrive for Business are assigned to the service account
5 Update M365 Excel/OneDrive/Calendar packages to latest version in Control Room
6 Test Graph API directly using Microsoft Graph Explorer (https://developer.microsoft.com/en-us/graph/graph-explorer) with the service account — call GET /me/drive to confirm OneDrive access

 

🔬 Quick Diagnostic Test

Use Microsoft Graph Explorer (https://graph.microsoft.com) signed in as the service account and run:

GET https://graph.microsoft.com/v1.0/me/drive
GET https://graph.microsoft.com/v1.0/me/calendar
  • If these return 200 OK → the issue is in AA's package/token configuration.
  • If these return 403 Forbidden or 404 Not Found → the issue is OneDrive provisioning or licensing.
  • If these return 401 Unauthorized → the issue is OAuth scopes/token.