I'm using Sitecore 9.2 scaled environment on Azure, and am trying to make a .Net core 2.2 project published on app service azure connects to XConnect which is also on Azure, am following this link from Sitecore documentation.

Am connecting with the following code

var xdbCollectionCert = "StoreName=My;StoreLocation=CurrentUser;FindType=FindByThumbprint;FindValue={thumbprintvalue}";
var xdbClient = "{XConnectName}"
var odataEndpoint = xdbClient + "/odata";
var collectionEndpoint = xdbClient + "/configuration";
var options = CertificateHttpClientHandlerModifierOptions.Parse(xdbCollectionCert);

var certificateModifier = new CertificateHttpClientHandlerModifier(options);

var clientModifiers = new List<IHttpClientModifier> { new TimeoutHttpClientModifier(new TimeSpan(0, 0, 20)) };

var collectionClient = new CollectionWebApiClient(new Uri(odataEndpoint), clientModifiers, new[] { certificateModifier });
var searchClient = new SearchWebApiClient(new Uri(odataEndpoint), clientModifiers, new[] { certificateModifier });

var configurationClient = new ConfigurationWebApiClient(new Uri(collectionEndpoint), clientModifiers, new[] { certificateModifier });
var cfg = new XConnectClientConfiguration(new XdbRuntimeModel(CollectionModel.Model), collectionClient, searchClient, configurationClient);
await cfg.InitializeAsync();

It worked fine in the .Net Core 2.2 project locally but when I tried it on the Azure I got stuck in the certificate part. I tried to do the same thing I have done locally and put the certificate in TLS and added WEBSITE_LOAD_CERTIFICATES, but with no luck it gives an error that certificate not found

Sitecore.XConnect.XdbCollectionUnavailableException: The certificate was not found. Store: My, Location: CurrentUser, FindType: FindByThumbprint, FindValue: {thumbprintValue}, InvalidAllowed: False.
at Sitecore.Xdb.Common.Web.CertificateHttpClientHandlerModifier.Process(HttpClientHandler handler)
at Sitecore.Xdb.Common.Web.CommonWebApiClient`1.CreateRequestHandler()
at Sitecore.Xdb.Common.Web.CommonWebApiClient`1.CreateClient()
at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy`1.CreateValue()
at Sitecore.Xdb.Common.Web.CommonWebApiClient`1.ExecuteAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at Sitecore.Xdb.Common.Web.CommonWebApiClient`1.ExecuteGetAsync(Uri route, IDictionary`2 keys)
at Sitecore.XConnect.Client.WebApi.ConfigurationWebApiClient.Refresh()
--- End of inner exception stack trace ---
at Sitecore.XConnect.Client.WebApi.ConfigurationWebApiClient.Refresh()
at Sitecore.XConnect.Client.XConnectClientConfiguration.InitializeAsync()

So, I tried this code from this link. To get the certificate from Azure:

X509Store certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);
X509Certificate2Collection certCollection = certStore.Certificates.Find(
                        // Replace below with your certificate's thumbprint
// Get the first cert with the thumbprint
if (certCollection.Count > 0)
    X509Certificate2 cert = certCollection[0];
    // Use certificate

but count returns zero.

Can someone please advise?

  • Did you install Client Certificate on app service which is making a call to XConnect ? Nov 26, 2019 at 15:09
  • @Surya yes but it gives the same error that "The certificate was not found" Nov 26, 2019 at 15:11
  • I have added steps in answer. Please follow those steps and let us know. It looks like you have installed a wrong certificate. Nov 26, 2019 at 15:17
  • I found it and asked a new question sitecore.stackexchange.com/questions/23204/… please see this Nov 28, 2019 at 13:48

1 Answer 1


It seems that you have not installed client certificate on app service from which you are trying to connect to xconnect.

  1. Go to connectionstring.config of your website and note thumbprint of the certificate
  2. Go to app service where you are running this code and navigate to TLS/SSL settings and then click on Private Key Certificates (.pfx)
  3. You should be able to see that certificate with the same thumbprint.
  4. If missing, install client cert and run your code.

Hope this helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.