Skip to main content
Question

Need clarity on oauth connection for M365 EXCEL in the control room

  • Nov 12, 2026 7:50 AM UTC
  • 6 replies
  • 56 views

In Microsoft console, I have created an appln project and have the required client ID, Secret ID, etc. But while trying to establish oauth connection, it is asking for admin consent in the client’s dev control room. But i did not face any such issues while establishing oauth connection in google sheet/mail. Is this the procedure for microsoft oauth connection in Automation anywhere?
Also one more question- Do we need to refresh the connection every now and then? If our bots run through out the day, is it reliable? Am trying to replace the Desktop excel with the M365 Excel. 

6 replies

Forum|alt.badge.img
  • Cadet | Tier 2
  • Nov 12, 2026 2:16 PM UTC

HI ​@Sujitha M 

Did you select Grant Type = Client Credential Flow in the OAuth connection settings? If Authorization Code Flow is selected, it will typically prompt for admin consent during authentication. With Client Credential Flow, this requirement is generally avoided as the application authenticates using the client ID and secret.

Regarding connection expiry, you do not need to manually refresh the OAuth connection periodically. For all the OAuth connections I have worked with, the access token is automatically refreshed when the bot uses the connection.

The main thing to watch for is the client secret/credential expiration configured in the Microsoft portal. When the secret expires, you will need to generate a new secret and update the OAuth connection in Automation Anywhere. To minimize maintenance, I would recommend selecting the maximum allowed credential expiry period when creating the client secret.


  • Author
  • Cadet | Tier 2
  • Nov 12, 2026 3:19 PM UTC

Thanks @bijesht for the info, I will check the settings option.


KhaledMostafaMe
Most Valuable Pathfinder
Forum|alt.badge.img+2
  • Most Valuable Pathfinder
  • Nov 12, 2026 7:51 PM UTC

@Sujitha M  Good question, this one trips up a lot of teams moving from Google to Microsoft.

Yes, the admin consent prompt is normal for Microsoft 365. It is a one-time approval by the client's Entra ID admin, and once the connection is saved with a refresh token, your bots can run all day without you refreshing anything.

Here is how the two pieces fit together:

  1. Why Microsoft asks for admin consent and Google did not: In Microsoft Entra ID, the tenant decides which Graph permissions a user may approve alone. Many organisations lock this down, and permissions such as Files.ReadWrite.All or Sites.ReadWrite.All need an admin either way. The fix is not in Automation Anywhere: ask the client's Entra admin to open your app registration, go to API permissions and click Grant admin consent for <tenant>. After that, the prompt disappears. A small correction on the Client Credentials idea above: that flow uses Application permissions, and those always need admin consent, so switching grant type does not avoid the admin.
  2. Do you need to refresh the connection? No, as long as you add the offline_access scope. The Control Room then gets a refresh token and renews the access token before it expires. Without that scope you would have to refresh it by hand. For unattended runs, select Save login credentials so the connection holds a shared token, and choose the Shared token type in your bot. See Create OAuth connection.
  3. Is it reliable for bots running through the day? Yes. The one thing that will break it is the client secret expiring in Azure, so note its expiry date and update the connection before then, as@bijesht  mentioned.

Once consent is granted, test the connection from the Control Room first, then swap your Desktop Excel actions over. Happy to help with the scope list if you share which Excel actions you use.


  • Author
  • Cadet | Tier 2
  • Nov 17, 2026 7:52 AM UTC

Thanks for the details ​@KhaledMostafaMe. will check and apply !


  • Author
  • Cadet | Tier 2
  • Nov 19, 2026 10:36 AM UTC

​@KhaledMostafaMe, Grant admin consent is not clickable. Kindly guide how to proceed further. Also, i changed the scope in oauth connection in AA to offlice_access.  


KhaledMostafaMe
Most Valuable Pathfinder
Forum|alt.badge.img+2
  • Most Valuable Pathfinder
  • Nov 19, 2026 12:44 PM UTC

@Sujitha M  Your screenshot explains the greyed-out button, and it also shows what to fix before the admin clicks it.

Only the client's Entra admin can grant this consent, and the greyed-out button means your login can't.

Do these four things in this order.

  1. Why the button is greyed out: Tenant-wide consent needs a directory role, and your Azure login doesn't have one. Send the client's Entra admin your app registration name. They open API permissions and click Grant admin consent. Microsoft's AADSTS65001 error (you may see it later if consent is missing) is fixed the same way.

  2. Application vs Delegated: Application permissions act as the app with no signed-in user, which is what Client Credentials uses. An Authorization Code connection signs in as a user, so it needs Delegated permissions. Remove User.Create and User.ReadWrite.All, since no Excel bot needs them. Replace the Application file rows with Files.ReadWrite.All and User.Read as Delegated.

  3. The scope field: Fix the typo to offline_access and keep it alongside the other scopes: offline_access, openid, https://graph.microsoft.com/.default. The docs separate scopes with commas. The .default value picks up the Delegated permissions you just added. Without offline_access, the connection can't renew its token on its own. Microsoft's OpenID and OAuth scopes reference explains that this scope is what lets the app receive long-lived refresh tokens.

  4. Sign in again after consent: Tick Save login credentials, click Save changes and test connection, then check that the admin's consent covers offline_access too. If it doesn't, the refresh token can expire after 90 days or less, and the bot fails until someone signs in again. The signing-in account also needs a Microsoft 365 licence with OneDrive.

Setup details are in Create OAuth connection. If Connect still fails after consent, paste the exact error text here and we'll narrow it down.