Azure App Services provide plenty of features and options but you probably alredy know that.
One of the things that I like the most is the ability to configure things like Application Settings, Connection Strings at the App Service level and having these override the ones in Web.config or ConnectionStrings.config.
And, why would you want to remove settings from the original files and change the way it always worked? Well, first of all security reasons, as you would avoid storing either databases server addresses or connection credentials in your source, for example.
To configure Connection Strings, search for and select App Services, and then select your app. In the app’s left menu, select Configuration > Application Settings
![Azure App Service Configuration Connection Strings Blog Vinicius Deschamps](https://viniciusdeschamps.com.br/wp-content/uploads/2020/05/app-service-configuration-connection-strings-blog-vinicius-deschamps-1024x386.png)
To add a new connection string, click New connection string and provide the information is being requested just like you would do at the ConnectionStrings.config
![Azure App Service Configuration New Connection String Blog Vinicius Deschamps](https://viniciusdeschamps.com.br/wp-content/uploads/2020/05/azure-app-service-configuration-new-connection-string-blog-vinicius-deschamps-1024x386.png)
![Azure App Service Configuration Connection Strings Blog Vinicius Deschamps](https://viniciusdeschamps.com.br/wp-content/uploads/2020/05/azure-app-service-configuration-connection-strings-blog-vinicius-deschamps-1024x182.png)
Name: master
Value: Encrypt=True;TrustServerCertificate=False;Data Source=sitecoresysadmin.database.windows.net,1433;Initial Catalog=sitecoresysadmin-master-db;User Id=sitecoresysadmin-master;Password=mysupersecret;
Type: SQLAzure
Needless to say that you need to add all Connection Strings at the App Service level if you want to start this feature from start to finish. Also, keep in mind by setting anything at the App Service level it will override the content at your ConnectionStrings.config file.
Well, introductions made, it’s time to talk about Publishing Service running as Azure App Service.
Martin Terpstra, a Valtech co-worker, and I were investigating a few things at Sitecore Publishing Service. And in order to apply some changes, he asked me to double check if the configurations at the App Service level for Publishing Service would also be overriden as it happens for any other Sitecore role.
The reason he asked it is because the way Sitecore present ConnectionStrings in Publishing Service is slighty different from the other roles
- Location is different ..\config\global
- File name is sc.connectionstrings.xml
- Structure differs from regular ConnectionStrings
<Settings>
<Sitecore>
<Publishing>
<ConnectionStrings>
![Sitecore Publishing Service Connection Strings Blog Vinicius Deschamps](https://viniciusdeschamps.com.br/wp-content/uploads/2020/05/publishingservice-connectionstrings-blog-vinicius-deschamps-1024x244.png)
I’ve read the Publishing Service Installation Guide but couldn’t find anything related to Configuration files at App Service level versus file system, so I raised a ticket to Sitecore and here is their response
My understanding is that using the “Settings > Configuration” page on an app service you can modify override the “Application Settings” and “Connection Strings”, corresponding to the <appSettings> and <connectionStrings> nodes in the web.config.
Since, as you identified, the Publishing Service configuration does not follow the same configuration node structure you are not able to specify the connectionstrings to overwrite (because the publishing service web.config file does not contain a <connectionStrings> node).
That being said, Configuration > Application Settings can be used to override ConnectionStrings.config in all Sitecore Roles but Publishing Services.
I huge thanks to Sitecore Support, and being more especifically for Tyler Jass to assist with this question.
I hope you liked it, and I’ll see you on my next post!
Deixe um comentário