CRM 2016 integration with SharePoint 2016 On Premise (401) Unauthorized Error

We spent a lot of time while we encountered  the below exception when we were integrating CRM with SharePoint.

Exception: System.Net.WebException: The remote server returned an error: (401) Unauthorized.

Environment details:

CRM 2016 on-premise with Claims authentication enabled.
SharePoint Server On-premise with Claims authentication enabled.
User Account using to set up is Admin on both the CRM and Sharepoint servers.

Reason & Fix:

Fix suggested in the following MSDN Forum worked for us. (

It seems there is a known issue/bug with CRM 2016 that doesn’t allow this to work if you try using https in the MetadataEndPoint.

To get this working, you will have to temporarily do the following items before running the SharePoint Power Shell command.

Note : Make sure you note all the existing settings before executing below steps which helps you to roll back, if something goes wrong.


Open the CRM Deployment Manager tool
Disable CRM IFD
Disable CRM Claims Configuration
Open the IIS and remove the https binding on the CRM Web site and add back the http binding for the CRM Web site.
Run CRM Deployment Manager and change the properties of the deployment for the Web Address to use http instead of https.
Run an IISReset on the CRM Server to ensure this is now accessible via http.
Run the SharePoint PowerShell commands (you should be able to access the MetadataEndpoint using http vs. https now if you put it in the browser (and it should prompt to download a .json file).
Once the SharePoint commands are finished running, you need to reverse the changes above in CRM to re-enable IFD.
Change the CRM Web Address to use https in the CRM Deployment Properties.
Remove the http binding on the CRM Web site and add back the https binding, selecting the correct SSL Certificate.
Run the Configure CRM Claims in the CRM Deployment Manager.  (keep the existing settings)
Run the Configure IFD in the CRM Deployment Manager (keep existing settings).
Run an IISReset on the CRM Server.

I would highly recommend you Refer MSDN article  which details integrating SharePoint on-premise with CRM on-premise.


Popular posts from this blog

How to Query Microsoft Dataverse Data using SQL from Power BI or SSMS

Users Unable to See Flow Button and run On Demand workflows in Dynamics 365 CE

How To Deploy Dynamics App For Outlook (On-Premise)