web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

The HTTP request is unauthorized with client authentication scheme 'Anonymous'.

(0) ShareShare
ReportReport
Posted on by 1,577

Hello. We have a console app which imports and updates records to our (cloud) dynamics 365 from a SQL table using OrganizationRequestCollection/ExecuteMultipleRequest

If the number of records processed is low there is no issue. Often there is no issue with processing "high" volumes (15k -20k records) but sometimes (- with no consistent cause - it actually seems to vary from job-run to job-run) the import stops (*NOT immediately, but randomly after processing 10 or 14 "chunks" (of 500 rows) with the following error:

error The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Bearer authorization_uri=login.microsoftonline.com/guid_which_i_can’t_reconcile/oauth2/authorize, resource_id=https://our_dynamics_ 365_ url'.

I can't stress enough - , the error is inconsistent - 95% of the time it does not occur but when it does, I have no control over the cause - it seems to be dependent on time-of-run.

Does anyone know (a) what this error means and (b) how to stop it - note the "unauthorised" is strange because it displays this error DURING processing rather than at the start so is there some sort of token or authorisation which needs to be renewed or set to persist forever?

Very grateful for any help or advice,

Thanks,

- Seamus

I have the same question (0)
  • GabB Profile Picture
    5 on at
    RE: The HTTP request is unauthorized with client authentication scheme 'Anonymous'.

    Hello Seamus , did the solution 1 and 2 resolved your issue? I am experiencing this issue as well. Thank you :)

  • Seamus Profile Picture
    1,577 on at
    RE: The HTTP request is unauthorized with client authentication scheme 'Anonymous'.

    I am able to catch the error and recreate the crmserviceclient object but normal processing does not resume. Is there any way to check the authorisation token and renew it as necessary? The error seems to be occuring after about an hour.  This has never happened before - could it be something temporary at the Microsoft/server level? Many thanks for any advice.

  • Seamus Profile Picture
    1,577 on at
    RE: The HTTP request is unauthorized with client authentication scheme 'Anonymous'.

    Thanks very much Guido for your helpful input. You are correct - it definitely is NOT consistent behaviour. I have done your suggestions 1&2 but will look at (3) - Thanks!

  • Verified answer
    Guido Preite Profile Picture
    54,084 Moderator on at
    RE: The HTTP request is unauthorized with client authentication scheme 'Anonymous'.

    in my experience there isn't always a root cause and I think that if you are using the .NET SDK the library should be always able to regenerate underline the required token without prompting that message.

    My suggested approach would be

    1) always update to the latest .NET SDK nuget packages (probably you already did that)

    2) use an azure app registration (maybe you are already using it but you didn't specify, in case you are still using username/password)

    3) implement inside your code a retry logic that recreate the CrmServiceClient object if you get an error or the IsReady property is returning false

    hope it helps

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 258

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 180

#3
Tom_Gioielli Profile Picture

Tom_Gioielli 92 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans