Identity Server Environment Specific Configuration

Mark Gibbons
1 min readMar 20, 2020

--

In Identity Server, the default path of environment specific connection strings are set in Config\production\Sitecore.IdentityServer.Host.xml. This is a problem because we cannot easily make use of the SITECORE_environment config as documented here.

If the Sitecore.IdentityServer.Host.xml file was instead deployed by default to the Config folder, it would solve this problem.

This location of the connection strings is also inconsistent with other Sitecore Host apps (e.g. Horizon) which put the environment specific connection strings in the Config folder instead of the Config\production folder.

It also is inconsistent with Sitecore core roles (CM, CD) which by default have the App_Data\ConnectionStrings.config as a global configuration that does not change depending on the env:define setting in the web.config

I also struggled to find information on how to set the SITECORE_environment — but the Microsoft documentation showed how this could be done. For example in the Identity Server web.config:

<aspNetCore processPath=”dotnet” arguments=”.\Sitecore.IdentityServer.Host.dll” stdoutLogEnabled=”false” stdoutLogFile=”.\logs\stdout”>
<environmentVariables>
<environmentVariable name=”SITECORE_ENVIRONMENT” value=”Development” />
</environmentVariables>
</aspNetCore>

The way I see it, we unfortunately have two options for DevOps management of config changes. In this example say I want to patch in a config called enableAzure.xml to enable Azure AD and set a specific ClientId:

  • Have the release pipeline deploy a different file to /config/production/enableAzure.xml per environment
  • Have the release pipeline copy Config\production\Sitecore.IdentityServer.Host.xml to Config\zSitecore.IdentityServer.Host.xml and set the SITECORE_environment:<env>. Then deploy /config/<env>/enableAzure.xml

I’ve raised this issue with Sitecore Support for Sitecore 9.3 so let’s hope that it will be fixed in future releases.

Note: all the logic for how the config is resolved is done in Sitecore.Framework.Runtime.Hosting.SitecoreHostingEnvironment

--

--

Mark Gibbons
Mark Gibbons

Written by Mark Gibbons

Technical Architect @ Aceik | Sitecore Technology MVP 2020 - 2024 with a love for all things #Sitecore / Twitter twitter.com/markgibbons25

No responses yet