0

I am trying to setup Sitecore CD to work with Blue/Green deployments. As part of this configuration, I am tying to get our database to stay sticky to the staging and production deployment slots

This is my setup:

  1. Cloned an existing web database in the specific environment
  2. Created the CD app and a slot in the app service using an ARM template in the same environment. This template also creates a connectionString setting in the slot for a database that was cloned in step 1. This connectionString is sticky so that the database is always the same for a particular slot, i.e. web app named staging-web is always point to staging-db. This prevents the connectionStrings being swapped during the slot swap

The problem I have is that the values in the app service's connectionstring, do not appear to be read, it seems that the app service is only reading the values that are defined in the connectionStrings.config

How can I fix this issue so that the app only read from the app service's connectionstring setting?

2
  • Do you have an empty entry in the connectionstrings.config for your web db?
    – Gatogordo
    Mar 31, 2021 at 9:21
  • delete all the connection strings from connectionstrings.config, so it reads the value from configuration section Aug 26, 2022 at 5:06

2 Answers 2

0

It doesn't seem like you are configuring your app service specific connection strings correctly. In fact these should be sticky and follow the app service during a swap.

In your case, it seems you are configuring them to be slot-specific, which is not what should happen.

So to fix this, ensure the app service specific connection string are not marked as a deployment slot setting on the Configuration settings within Azure portal. This should resolve this issue.

There is further guidance from Azure on how to set up staging slot in Azure App Service

2
  • Thanks Julius A, but I thought that deployment slot settings are sticky to the slot, so they SHOULD be ticked so that I don't want to swap the db conn string?
    – guestdj
    Mar 31, 2021 at 13:36
  • Yes that is correct. So in your architecture, your database is sticky to the slot? My answer presumed the each app has its own db which is swapped alongside with it.
    – Julius A
    Mar 31, 2021 at 14:16
0

Fixed this by removing the configBuilder attribute that referenced the SitecoreConnectionStringsBuilder from the connectionString node in the ConnectionStrings.config file, e.g.

<connectionStrings>
    <add name="web" ... 
</connectionStrings>

It seems that SitecoreConnectionStringsBuilder does not look in the app services conn strings

2
  • Did you try and prefix your connection string with prefix="SITECORE_CONNECTIONSTRINGS_" as defined within SitecoreConnectionStringsBuilder?
    – Julius A
    Mar 31, 2021 at 17:39
  • This should work, by default it takes connection strings from confit file then app configuration settings Apr 1, 2021 at 4:25

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.