{"id":9071,"date":"2025-07-30T11:02:17","date_gmt":"2025-07-30T11:02:17","guid":{"rendered":"https:\/\/pariswells.com\/blog\/?p=9071"},"modified":"2025-07-30T11:02:18","modified_gmt":"2025-07-30T11:02:18","slug":"connecting-dynamics-crm-to-exchange-online-via-new-app-registration","status":"publish","type":"post","link":"https:\/\/pariswells.com\/blog\/research\/connecting-dynamics-crm-to-exchange-online-via-new-app-registration","title":{"rendered":"Connecting Dynamics CRM to Exchange Online via new App Registration"},"content":{"rendered":"\n<p><a href=\"https:\/\/learn.microsoft.com\/en-us\/dynamics365\/customerengagement\/on-premises\/admin\/connect-dynamics-365-on-premises-exchange-online?view=op-9-1\">Connect Exchange Online to Dynamics 365 Customer Engagement (on-premises) | Microsoft Learn<\/a><\/p>\n\n\n\n<p>If you get the below error while testing a mailbox , make SURE You use the App Service Account ( E.g. &#8216;Network Service&#8217; ) with CertificateReconfiguration.ps1 &#8211;<\/p>\n\n\n\n<p><a href=\"https:\/\/global.hitachi-solutions.com\/blog\/setup-dynamics-365-server-side-synchronization-premise-exchange-online\/\">How to Setup Dynamics 365 Server-Side Synchronization for On-Premise to Exchange Online \u2013 Hitachi Solutions<\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">Message from 365::\n\nAcquiring Token from ACS has failed. Please check if your tenantId is specified correctly in your Email Server Profile, and make sure your Exchange and CRM are under the same tenant\n\nRequest to Exchange::\n\n&lt;trace tag=\"AutodiscoverConfiguration\" tid=\"63\" time=\"2025-07-30 04:53:17Z\">\nStarting SCP lookup for domainName='[REDACTED]', root path=''\n&lt;\/trace>\n&lt;trace tag=\"AutodiscoverConfiguration\" tid=\"63\" time=\"2025-07-30 04:53:18Z\">\nSearching for SCP entries in LDAP:\/\/CN=Configuration,DC=[REDACTED]\n&lt;\/trace>\n&lt;trace tag=\"AutodiscoverConfiguration\" tid=\"63\" time=\"2025-07-30 04:53:18Z\">\nScanning for SCP pointers Domain=[REDACTED]\n&lt;\/trace>\n&lt;trace tag=\"AutodiscoverConfiguration\" tid=\"63\" time=\"2025-07-30 04:53:18Z\">\nNo SCP pointers found for 'Domain=[REDACTED]' in configPath='CN=Configuration,DC=[REDACTED]'\n&lt;\/trace>\n&lt;trace tag=\"AutodiscoverConfiguration\" tid=\"63\" time=\"2025-07-30 04:53:18Z\">\nDetermining which endpoints are enabled for host [REDACTED]\n&lt;\/trace>\n&lt;trace tag=\"AutodiscoverConfiguration\" tid=\"63\" time=\"2025-07-30 04:53:45Z\">\nRequest error: Unable to connect to the remote server\n&lt;\/trace>\n&lt;trace tag=\"AutodiscoverConfiguration\" tid=\"63\" time=\"2025-07-30 04:53:45Z\">\nNo Autodiscover endpoints are available for host [REDACTED]\n&lt;\/trace>\n&lt;trace tag=\"AutodiscoverConfiguration\" tid=\"63\" time=\"2025-07-30 04:53:45Z\">\nDetermining which endpoints are enabled for host [REDACTED]\n&lt;\/trace>\n&lt;trace tag=\"AutodiscoverConfiguration\" tid=\"63\" time=\"2025-07-30 04:54:14Z\">\nRequest error: Unable to connect to the remote server\n&lt;\/trace>\n&lt;trace tag=\"AutodiscoverConfiguration\" tid=\"63\" time=\"2025-07-30 04:54:14Z\">\nNo Autodiscover endpoints are available for host [REDACTED]\n&lt;\/trace>\n&lt;trace tag=\"AutodiscoverConfiguration\" tid=\"63\" time=\"2025-07-30 04:54:14Z\">\nTrying to get Autodiscover redirection URL from http:\/\/[REDACTED]\/autodiscover\/autodiscover.xml.\n&lt;\/trace>\n&lt;trace tag=\"AutodiscoverConfiguration\" tid=\"63\" time=\"2025-07-30 04:54:14Z\">\nRedirection URL found: 'https:\/\/autodiscover-s.outlook.com\/autodiscover\/autodiscover.xml'\n&lt;\/trace>\n&lt;trace tag=\"AutodiscoverConfiguration\" tid=\"63\" time=\"2025-07-30 04:54:14Z\">\nDetermining which endpoints are enabled for host autodiscover-s.outlook.com\n&lt;\/trace>\n&lt;trace tag=\"AutodiscoverConfiguration\" tid=\"63\" time=\"2025-07-30 04:54:14Z\">\nRequest error: The remote server returned an error: (401) Unauthorized.\n&lt;\/trace>\n&lt;trace tag=\"AutodiscoverConfiguration\" tid=\"63\" time=\"2025-07-30 04:54:14Z\">\nHost returned enabled endpoint flags: Legacy, Soap, WsSecurity, WSSecuritySymmetricKey, WSSecurityX509Cert, OAuth\n&lt;\/trace>\n&lt;trace tag=\"AutodiscoverRequestHttpHeaders\" tid=\"63\" time=\"2025-07-30 04:54:14Z\">\nPOST \/autodiscover\/autodiscover.svc HTTP\/1.1\nContent-Type: text\/xml; charset=utf-8\nAccept: text\/xml\nUser-Agent: CRM\/9.0.0.0\/OnPremise (ExchangeServicesClient\/15.0.1076.7)\nclient-request-id: [REDACTED]\nreturn-client-request-id: true\n&lt;\/trace>\n&lt;trace tag=\"AutodiscoverRequest\" tid=\"63\" time=\"2025-07-30 04:54:14Z\" version=\"15.0.1076.7\">\n&lt;!--?xml version=\"1.0\" encoding=\"utf-8\"?-->\n&lt;soap:envelope xmlns:a=\"http:\/\/schemas.microsoft.com\/exchange\/2010\/Autodiscover\" xmlns:wsa=\"http:\/\/www.w3.org\/2005\/08\/addressing\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xmlns:soap=\"http:\/\/schemas.xmlsoap.org\/soap\/envelope\/\">\n&lt;soap:header>\n&lt;a:requestedserverversion>Exchange2013&lt;\/a:requestedserverversion>\n&lt;wsa:action>http:\/\/schemas.microsoft.com\/exchange\/2010\/Autodiscover\/Autodiscover\/GetUserSettings&lt;\/wsa:action>\n&lt;wsa:to>https:\/\/autodiscover-s.outlook.com\/autodiscover\/autodiscover.svc&lt;\/wsa:to>\n&lt;\/soap:header>\n&lt;soap:body>\n&lt;a:getusersettingsrequestmessage xmlns:a=\"http:\/\/schemas.microsoft.com\/exchange\/2010\/Autodiscover\">\n&lt;a:request>\n&lt;a:users>\n&lt;a:user>\n&lt;a:mailbox>[REDACTED]&lt;\/a:mailbox>\n&lt;\/a:user>\n&lt;\/a:users>\n&lt;a:requestedsettings>\n&lt;a:setting>ExternalEwsUrl&lt;\/a:setting>\n&lt;a:setting>InternalEwsUrl&lt;\/a:setting>\n&lt;\/a:requestedsettings>\n&lt;\/a:request>\n&lt;\/a:getusersettingsrequestmessage>\n&lt;\/soap:body>\n&lt;\/soap:envelope>\n&lt;\/trace>\n\nResponse from Exchange:\n\nMicrosoft.Exchange.WebServices.Data.ServiceRequestException: The request failed. The request was aborted: The request was canceled. ---> System.Net.WebException: The request was aborted: The request was canceled. ---> Microsoft.Crm.CrmException: Access token could not be obtained from: https:\/\/accounts.accesscontrol.windows.net\/tokens\/OAuth\/2 for resource: [REDACTED] ---> Microsoft.Crm.CrmException: Certificate: [REDACTED] with FindType: FindBySubjectDistinguishedName was not found in Store: My at StoreLocation: LocalMachine.\nat Microsoft.Crm.Authentication.Claims.CertificateUtility.RetrieveICertificate(CertificateData certificateData)\nat Microsoft.Crm.Authentication.Claims.CertificateUtility.GetICertificate(String certificateType)\nat Microsoft.Crm.Authentication.Claims.CertificateUtility.GetCertificate(String certificateType)\nat Microsoft.Crm.Authentication.S2S.CrmClientServicePrincipal.get_SigningCredentials()\nat Microsoft.Crm.Authentication.S2S.AuthorizationServerIssuedOAuthCredentials.GetSignedAccessTokenData(ServicePrincipal issuerPrincipal, WebRequest request)\n--- End of inner exception stack trace ---\nat Microsoft.Crm.Authentication.S2S.AuthorizationServerIssuedOAuthCredentials.GetSignedAccessTokenData(ServicePrincipal issuerPrincipal, WebRequest request)\nat Microsoft.Crm.Authentication.S2S.AccessTokenCache.AccessTokenFactory.GetAccessToken(GetNewAccessTokenDelegate getNewAccessTokenDelegate, ITraceListener traceListener)\nat Microsoft.Crm.Authentication.S2S.AuthorizationServerIssuedOAuthCredentials.GetAccessToken(ServicePrincipal issuerPrincipal, WebRequest request)\nat Microsoft.Crm.Authentication.S2S.OAuthCredentials.AuthenticateInternal(ServicePrincipal issuerPrincipal, WebRequest request)\nat Microsoft.Crm.Authentication.S2S.OAuthCredentials.PreAuthenticate(WebRequest request)\nat System.Net.AuthenticationManagerDefault.Authenticate(String challenge, WebRequest request, ICredentials credentials)\nat System.Net.AuthenticationState.AttemptAuthenticate(HttpWebRequest httpWebRequest, ICredentials authInfo)\nat System.Net.HttpWebRequest.CheckResubmitForAuth()\nat System.Net.HttpWebRequest.CheckResubmit(Exception&amp; e, Boolean&amp; disableUpload)\nat System.Net.HttpWebRequest.DoSubmitRequestProcessing(Exception&amp; exception)\nat System.Net.HttpWebRequest.ProcessResponse()\nat System.Net.HttpWebRequest.SetResponse(CoreResponseData coreResponseData)\n--- End of inner exception stack trace ---\nat System.Net.HttpWebRequest.GetResponse()\nat Microsoft.Exchange.WebServices.Data.EwsHttpWebRequest.Microsoft.Exchange.WebServices.Data.IEwsHttpWebRequest.GetResponse()\nat Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverRequest.InternalExecute()\n--- End of inner exception stack trace ---\nat Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverRequest.InternalExecute()\nat Microsoft.Exchange.WebServices.Autodiscover.GetUserSettingsRequest.Execute()\nat Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.InternalGetUserSettings(List1 smtpAddresses, List1 settings, Nullable1 requestedVersion, Uri&amp; autodiscoverUrl)    at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.GetSettings[TGetSettingsResponseCollection,TSettingName](List1 identities, List1 settings, Nullable1 requestedVersion, GetSettingsMethod2 getSettingsMethod, Func1 getDomainMethod)\nat Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.GetUserSettings(List1 smtpAddresses, List1 settings)\nat Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.InternalGetSoapUserSettings(String smtpAddress, List`1 requestedSettings)\nat Microsoft.Crm.Asynchronous.EmailConnector.ExchangeConnectivityDiscoverer.DiscoverUserSettingsInternal()<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Connect Exchange Online to Dynamics 365 Customer Engagement (on-premises) | Microsoft Learn If you get the below error while testing a mailbox , make SURE You use [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-9071","post","type-post","status-publish","format-standard","hentry","category-research"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/9071","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/comments?post=9071"}],"version-history":[{"count":1,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/9071\/revisions"}],"predecessor-version":[{"id":9072,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/9071\/revisions\/9072"}],"wp:attachment":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/media?parent=9071"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/categories?post=9071"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/tags?post=9071"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}