Enable xConnect on a local developer machine


In this post

Example configuration files and certificate set-up steps.

What I wanted to do

Install xConnect alongside Sitecore XP 9.0.1 on a developer machine, in xp0 configuration. I didn’t have Powershell 5.1 installed, so had to go ahead without SIF. Yes, it was a bit of a nightmare.


  • Packages for XP Single from Sitecore Downloads
  • DACPAC databases from that package installed
  • xConnect IIS site from that package hosted locally (devxc.perks.com)
  • Sitecore XP9 hosted locally (dev.perks.com)

Generate a server certificate

New-SelfSignedCertificate -certstorelocation cert:\LocalMachine\My -dnsname *.perks.com

Generate a client certificate

New-SelfSignedCertificate -certstorelocation cert:\LocalMachine\My -dnsname devxc.perks.com

Note down the thumbprint for later:

Thumbprint                                Subject
----------                                -------
7E8DAE07DA298A9681D867F4B65BF4241C064A92  CN=devxc.perks.com

Export and Import

Export the client and server certificates (using Certificate Manager) and re-import them to the following locations:

  • LocalMachine > Trusted Root Certification Authorities

Assign the *.perks.com certificate

Assign the *.perks.com server certificate to the IIS sites dev.perks.com and devxc.perks.com

Ensure devxc.perks.com has Require SSL [ON] and Client certificates [Accept]

Add certificate details to Sitecore XP Connectionstrings.config

<add name="xconnect.collection.certificate" connectionString="StoreName=My;StoreLocation=LocalMachine;FindType=FindByThumbprint;FindValue=7E8DAE07DA298A9681D867F4B65BF4241C064A92;AllowInvalidClientCertificates=true" />
<add name="xdb.referencedata.client.certificate" connectionString="StoreName=My;StoreLocation=LocalMachine;FindType=FindByThumbprint;FindValue=7E8DAE07DA298A9681D867F4B65BF4241C064A92;AllowInvalidClientCertificates=true" />
<add name="xdb.marketingautomation.reporting.client.certificate" connectionString="StoreName=My;StoreLocation=LocalMachine;FindType=FindByThumbprint;FindValue=7E8DAE07DA298A9681D867F4B65BF4241C064A92;AllowInvalidClientCertificates=true" />
<add name="xdb.marketingautomation.operations.client.certificate" connectionString="StoreName=My;StoreLocation=LocalMachine;FindType=FindByThumbprint;FindValue=7E8DAE07DA298A9681D867F4B65BF4241C064A92;AllowInvalidClientCertificates=true" />

Add certificate details to xConnect Connectionstrings.config

<add name="xconnect.collection.certificate" connectionString="StoreName=My;StoreLocation=LocalMachine;FindType=FindByThumbprint;FindValue=7E8DAE07DA298A9681D867F4B65BF4241C064A92;AllowInvalidClientCertificates=true" />
<add name="xdb.referencedata.client.certificate" connectionString="StoreName=My;StoreLocation=LocalMachine;FindType=FindByThumbprint;FindValue=7E8DAE07DA298A9681D867F4B65BF4241C064A92;AllowInvalidClientCertificates=true" />

Modify xConnect AppSettings.config

<add key="AllowInvalidClientCertificates" value="true" />
<add key="validateCertificateThumbprint" value="7E8DAE07DA298A9681D867F4B65BF4241C064A92" />

Restart! Restart!

Restart IIS, your machine, switch your house lights on and off a few times. Open a window.


Export and Import the certificates into:

  • Current User > Personal
  • Current User > Trusted Root Certification Authorities

Use Certificate Manager to grant Read permissions to your certificates.

Remove any non-self-signed certificates from your Local Machine > Trusted Root Certification Authorities store. Beware doing this on your work PC, as some corporate certificates may be changed.

Associated error messages

FATAL [Experience Analytics]: Failed to synchronize segments. Message: Ensure definition type did not complete successfully. StatusCode: 401, ReasonPhrase: 'Invalid certificate', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
Exception: System.InvalidOperationException
Message: The certificate was not found.
Source: Sitecore.Xdb.Common.Web
   at Sitecore.Xdb.Common.Web.CertificateWebRequestHandlerModifier.Process(HttpClientHandler handler)
ERROR Exception when executing agent aggregation/aggregator
Exception: Sitecore.XConnect.XdbCollectionUnavailableException
Message: The HTTP response was not successful: Forbidden
Source: Sitecore.Xdb.Common.Web

Next steps

Please don’t use any of these steps in production! I’m only hacking around to get things running locally.

For further reading, check out:


Comment here or find @perks on Twitter. Feedback and corrections happily received.

xConnect error when using Deploy Marketing Definitions tool

In this post

Installing xConnect to an 8.0 > 9.0.1 Sitecore upgrade resulted in some duplicate items in the content tree. This stops the Deploy Marketing Definitions tool from completing.


I had nearly completed an installation of xConnect with Sitecore 9.0.1, in xp0 configuration. Toward the end, I used the Control Panel > Analytics > Deploy Marketing Definitions tool. It thought for a little while, then blew up, asking me to check the logs. When I did, I found this message:

8876 16:00:59 ERROR One or more exceptions occurred while processing the subscribers to the 'item:saving' event.
Exception[1]: System.InvalidOperationException 
Message[1]: Multiple items were found by alias 'Field Completed' 
Source[1]: Sitecore.Marketing.xMgmt 
 at Sitecore.Marketing.Definitions.Repository.ItemDefinitionRepositoryBase`1.GetItemIdByAlias(String alias)
 at Sitecore.Marketing.Definitions.Repository.ItemDefinitionRepositoryBase`1.GetByAlias(String alias, CultureInfo cultureInfo, Boolean includeInactiveVersion)
 at Sitecore.Marketing.Definitions.DefinitionManagerBase`2.GetByAlias(String alias, CultureInfo cultureInfo, Boolean includeInactiveVersion)
 at Sitecore.Marketing.xMgmt.Definitions.ItemEventHandler.ValidateAlias[TDefinitionInterface](ItemData itemData, Template itemTemplate, Guid expectedTemplateId, Dictionary`2 templateIdsInheritanceDictionary)
 at Sitecore.Marketing.xMgmt.Definitions.ItemEventHandler.ValidateItemName(ItemData itemData)
 at Sitecore.Marketing.xMgmt.Definitions.ItemEventHandler.OnItemSaving(Object sender, EventArgs args)
 at Sitecore.Events.Event.EventSubscribers.RaiseEvent(String eventName, Object[] parameters, EventResult result)


There were two Field Completed items (with the same template), in my tree at master:/sitecore/system/Settings/Analytics/Page Events/*

Checking the create dates, I see that the items in the Forms folder are newer. I guess the earlier ones are an overhang from our previous Sitecore 8 installation. In any case, I just renamed the older versions to {0} Old and now the Deploy Marketing Definitions tool completes. I’m now going to remove the duplicate items entirely, and ensure any links are redirected to the new version.

Create a custom Solr index in Sitecore 9

Hello there. 

Hi! So you want to create a new Solr index?

Yes, I think so?

It’s a great idea. You’ll be familiar with the big three, sitecore_core_index, sitecore_master_index and sitecore_web_index, but you don’t have to stop there! You can create individual indexes for certain content types on your site, such as Products. Smaller, more individualised indexes are easier to maintain, troubleshoot, faster to rebuild and can be faster to query.

Are they hard to set up?

Not as hard as you’d expect! Let’s create one now.

OK. My Solr is set up and I can access the web UI on https://solr:8983/solr/#/ – what now?

Let’s create the physical Solr core.

  1. Find your Solr index folder for the sitecore_master_index. Mine was at C:\solr\solr-6.6.2\server\solr\sitecore_master_index
  2. Copy this whole folder (into the same parent folder) and call it sitecore_master_products_index
  3. Inside the sitecore_master_products_index folder, open up the core.properties file and change the name property to read sitecore_master_products_index
  4. Restart Solr (I use the solr stop and solr start commands – see below)
  5. Now, go to https://solr:8983/solr/#/ and check out your cores – you will have a new one!

Awesome, it’s there. So I get that we copied the sitecore_master_index and renamed it to sitecore_master_products_index – and in Solr I can see that it contains thousands of documents already, copied from sitecore_master_index. How do I clean things up?

Well, good question. We want to delete all of the existing items in this index and start afresh. You can do this via a web browser – just call this URL:


Radical. Everything is deleted. Soo. I want to use this index to only contain certain types of content from Sitecore. How do I configure it properly?

We need to just add a single configuration file to Sitecore. It’s below. It looks mostly like the configuration file for sitecore_master_index, but we change two important things, (a) which template types we want to include in our index and (b) which field types we want to include in our index. In your real solution, this will take a bit of time to set up, but being selective is the whole point of creating a custom index, and you’ll want to keep it as trim as possible.

Here’s the whole config file, which I’ve called Sitecore.ContentSearch.Solr.Index.Master.Products.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:search="http://www.sitecore.net/xmlconfig/search/">
  <sitecore role:require="Standalone or ContentManagement" search:require="solr">
      <configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
        <indexes hint="list:AddIndex">
          <index id="sitecore_master_products_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
            <param desc="name">$(id)</param>
            <param desc="core">$(id)</param>
            <param desc="propertyStore" ref="contentSearch/indexConfigurations/databasePropertyStore" param1="$(id)" />
              <configuration ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration">
                  <documentOptions type="Sitecore.ContentSearch.SolrProvider.SolrDocumentBuilderOptions, Sitecore.ContentSearch.SolrProvider">

                      <!-- Included fields -->
                      <include hint="list:AddIncludedField">

                      <!-- Included templates -->
                      <include hint="list:AddIncludedTemplate">

            <strategies hint="list:AddStrategy">
              <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/syncMaster" />
            <locations hint="list:AddCrawler">
              <crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">

The two bits you’ll need to replace here are the bits commented as Included Fields and Included Templates:

<!-- Included fields -->
<include hint="list:AddIncludedField">

<!-- Included templates -->
<include hint="list:AddIncludedTemplate">

OK, done. I’ve added my list of templates, and fields here. So, can I reindex now and see my new content?

Absolutely. Go into Sitecore > Control Panel > Indexing Manager, find your index and rebuild it.

When you’re done, go back to the Solr UI and see your documents! If things didn’t go quite to plan, check in your site Crawling.log, which will contain any indexing errors.

Production ready?

Well, not quite. You might want to create a sitecore_web_products_index and use the Sitecore.ContentSearch.Solr.Index.Web.config configuration file as an example of how to register it in Sitecore. Using Sitecore’s conventions for master and web keep the surprises to a minimum.

Search on, pals!