How to Deploy a ASP.NET Core Agility CMS Sync Website to Azure App Service

This guide will walk you through how to deploy an Agility .NET Core website (using the Agility.AspNetCore package) to an Azure App Service in Azure.

Want to learn more about why Azure App Service can be a better choice versus a traditional VM?

What you Need

  • A Microsoft account with an Azure Subscription
  • An active Agility CMS instance configured for .NET Core
  • An Agility .NET Core site to deploy (see for an example) that you've tested works locally

What We'll Cover

  1. Create the Azure App Service in Azure
  2. Configure the App Service App
  3. Configure your Web App's appsettings.json
  4. Deploy your Site
  5. Register your Azure App Service as a Syncing Web Server in Agility CMS
  6. Configure your Production/Preview Domain in Agility CMS

Create the Azure App Service in Azure

  1. In the Azure Portal, go to

  2. Enter web app and select Web App from the list of results.


  3. Click Create to get started.


  4. Enter the Subscription you want to create the resource in, followed by the Resource Group (create a new one if you don't already one to use).


  5. Enter a Name for your web app, this will be used by default for your azure web app URL. For example, if you name your web app my-agility-netcore-site, then it will be available on the URL

  6. For Publish, select Code, then for Runtime stack, select .NET Core 3.1 (LTS), and for the Operating System, select Windows.

  7. For Region, you may select any available region. We recommend hosting your site in the same country as you or your customer's business.

  8. For App Service Plan, here you can configure the server(s) your web app will run on and what type of computing resources you will need.


  9. There are many different ways to configure your web app resources, and your needs will depend on how much traffic your web app will have among other factors. Generally, you can run your web app on any tier from free (F1) to more premium compute tiers. For a typical, production small site, we recommend starting with at least a single S1 instance. For heavier traffic sites, you can use two S1s or even a one or two P1V2s. The good news is you can always switch the tiers whenever you need to (without downtime) so you can start small and scale up the performance to a higher compute tier and add more instances to balance the load.


  10. When you are ready, click Apply to apply your selection and continue to set up Monitoring (recommended). This will create a new application insights resource you can use to monitor and troubleshoot application and performance issues.


  11. When ready, click Review + create to verify your settings.


  12. Click Create to create your App Service and the App Service Plan that will contain your web app.

Configure the App Service App

Now that you've created the web app, there are a few general settings we recommend reviewing.

  1. If your web app will be stateless, in the ConfigurationGeneral Settings, set ARR affinity to Off. 
  2. For security reasons, go to TLS/SSL Settings and set HTTPS Only to ON this will ensure that your web app is only ever accessible over https.

Azure App Configuration

Make sure WEBSITE_LOCAL_CACHE_OPTION is removed from your Azure App Configuration as it will cache content and override Agility Content files on app restart.

Configure your Web App's appsettings.json

In your website code, open your appsettings.json and ensure you set the contentCacheFilePath and logFilePath to the d:/home/ directory. This will utilize the App Service's local filesystem to store content files and logs that will be accessible to all instances (individual servers) within the App Service Plan.

Lastly, ensure that you set developmentMode to false this will configure the site to ONLY have access to published content that has synchronized from Agility CMS (via a Syncing Web Server).


  "Logging": {
    "LogLevel": {
      "Default": "Warning"
  "AllowedHosts": "*",
  "Agility": {
    "applicationName": "My Web Application",
    "websiteName": "{WebsiteName goes here}", 
    "securityKey": "{Security Key goes here}",
    "contentCacheFilePath": "d:/home/AgilityContent/",
    "contentServerUrl": "",
    "developmentMode": "false",
    "Trace": {
      "traceLevel": "Warning",
      "logFilePath": "d:/home/AgilityLogs/Website.log"
    "debugSync": "false",
    "UGC": {
      "Url": "",
      "Key": "{optional}",
      "Password": "{optional}"
    "Analytics": {
      "Url": ""

Deploy your Site

Now that you have created the Azure App Service and configured your web app to run in Azure App Service, it is time to deploy your site to Azure.

  1. Go the Overview page of your Azure App Service and click the Get Publish Profile button. This will download a file that you can import into Visual Studio.

To deploy via Visual Studio, please see Publish an application to Azure App Service by importing publish settings in Visual Studio.

To deploy via VS Code, please see Publish an ASP.NET Core app to Azure with Visual Studio Code.

Once you've deployed the app, it will likely not function correctly because you haven't synced content to it yet from Agility CMS. When you deploy an agility site with developmentMode=false it will run in a production mode, meaning it will try to access published content from its contentCacheFilePath. Because you haven't synced the site yet, this path will empty and you may receive application errors until the site is synced.

Register your Azure App Service as a Syncing Web Server in Agility CMS

Now that you've deployed your web app, you need to synchronize content to it so it can access cached, published content.

How to Add a Syncing Web Server

Configure your Production/Preview Domain in Agility CMS

Now that you've synced your web server, you'll want to register your domain URL for your pages as your production and preview domain so that editors can view content on that specific domain when previewing or reviewing content for their website.

Adding a Domain Configuration for a Website

Wrapping it all Up

By the end of this tutorial, you should have your site deployed to Azure running on an Azure App Service plan, have your site synced, and only showing published content, and enabled the ability for editors to click Preview from within the CMS and see the latest content in preview mode.

Other useful links:

0 out of 0 found this helpful



Please sign in to leave a comment.