Deploying to Azure Web Apps

Microsoft Azure Web Apps is a service which allows you to create and host websites in the cloud. By deploying your project to Azure, you can leverage additional features and services such as security, load balancing, auto-scaling, and automated management.

To host your project on Azure, you need to:

  1. Create a deployment environment in Azure using Azure Resource Manager
  2. Deploy the project's database to Azure SQL
  3. Publish the Xperience administration and MVC applications to Azure

Before you begin, please read the Pre-deployment checklist section first.

Pre-deployment checklist

The following is a list of issues you may encounter when deploying an existing project to Microsoft Azure. Assess whether they apply and adjust your project as recommended.

  • If your project uses manual web farms, the system may contain unnecessary web farm servers in the database. We recommend that you delete the old web farm servers in the administration interface (via the Web farm application) to ensure that a licensing error does not occur. Moreover, we strongly recommend switching to automatic web farms for the deployed project.
  • Your database may contain custom database objects that are not supported on Azure SQL. Because of this limitation of the Azure platform, you might not be able to migrate your database to Azure SQL without modifications. You might encounter issues when deploying your database to Azure if you have somehow customized your database (stored procedures, indexes, access to tables) or if you have developed custom modules.
On this page

Related pages

Creating a deployment environment for MVC projects using Azure Resource Manager

Xperience provides an Azure Resource Manager (ARM) template that helps you deploy all Azure services and resources necessary to host your application in Microsoft Azure.

  1. Open Microsoft's Azure Quickstart Templates repository and search for Kentico MVC.
  2. Open the Kentico MVC environment template and click Deploy to Azure at the top of the page.
  3. Under BASICS, select your Azure subscription, resource group, and resource location.
  4. Under SETTINGS, provide the information required to deploy Azure services used to host your MVC environment.

    Select a Basic or higher pricing tier for each App Service hosting plan. The Free and Shared hosting plans do not provide enough memory to run an Xperience application.

  5. Agree with the displayed terms and conditions and click Purchase.

The Azure Resource Manager deploys the two Web App instances and an Azure SQL server used to host your Xperience project in Azure. 

Deploying the project's database to Azure SQL

You can host your project in Azure Web Apps and keep your database in a standard Microsoft SQL server. However, we recommend that you also move your database to Azure to ensure the best performance:

  1. Open the Azure SQL server deployed by the template in the Azure portal.
  2. Click New database and:
    1. Specify the database name.
      • The database name should match the one you specified in the Connection String Database Name setting when deploying the ARM template. If you left the setting empty, you need to manually add database connection strings to the created Web Apps.

        Configuring the connection string after deployment

        You can also configure the connection string through the Azure Management Portal in App Services -> select a web app -> Application settings -> Connection strings section. Add the connection strings in the following format:

        • Name: CMSConnectionString
        • Value: Data Source=tcp:<SQL_SERVER_NAME>.database.windows.net,1433;Initial Catalog=<DATABASE_NAME>;User Id=<USER_NAME>@<SQL_SERVER_NAME>;Password=<USER_PASSWORD>;
        • Type: SQLServer

        Replace <SQL_SERVER_NAME><DATABASE_NAME><USER_NAME>, and <USER_PASSWORD> with the values you provided during the ARM template deployment.

    2. Leave the Select source dropdown set to Blank database.
    3. Select a pricing tier.
    4. Set the database collation to the one used by your local database (Latin1_General_CI_AS by default).
  3. Click OK

Azure creates a new database under the SQL server. Continue with configuring the SQL server's firewall rules to allow connections to the server from your local environment:

  1. Open the SQL server in the Azure portal.
  2. Switch to the Firewalls and virtual networks tab.
  3. Create a new access rule for the IP ranges of your development and administration machines.

Now you can deploy the project's SQL database to Azure. Please follow the instructions in the SQL Server database migration to SQL Database in the cloud  article according to your requirements.

Database server time zones

If possible, use the same time zone for both your local environment and the Azure SQL server. Otherwise you may encounter time shift problems with the deployed data, for example in the settings of scheduled tasks.

See: Changing the server time zone on Azure Web Apps

If you cannot synchronize the time zones, we recommend that you verify and reconfigure the timing settings of scheduled tasks after the deployment.

Publishing the Xperience administration and MVC applications to Azure

The last step in the deployment process is to publish the Xperience administration and MVC applications to the prepared Web App instances. This tutorial deploys both applications using the publishing wizard in Visual Studio.

Before you publish both applications:

  • Edit both project's web.config file and make sure that the sessionState mode is set to InProc.

    <sessionState mode="InProc" />

    Use InProc mode if you plan to use one instance of each Web App. However, if you need to scale out to more instances, you will need to configure the session state differently. See Storing session state data in an Azure environment.

  • If you plan to increase the number of instances associated with your Web App service (on the Scale out (App Service plan) tab), you need to configure web farms in your project to dynamically create and delete web farm servers. See Scaling Azure Web Apps for more information.
  • The publishing wizard only deploys files referenced in each application's .csproj file. If your project depends on any files not included in the solution (for example media library folders or files, script files, stylesheets, etc.), you need to add them using Visual Studio. Enable the Show All Files option in the Solution Explorer menu, locate the file, right-click the file and select Include in project.

Publishing the Xperience administration application

Begin by publishing the Xperience administration project:

  1. Open the Xperience administration project's solution (WebApp.sln) in Visual Studio.
  2. Right-click the CMSApp project in the Solution Explorer and select Publish....
  3. Select Microsoft Azure App Service and choose Select Existing.
  4. Click Publish.
  5. In the publishing wizard:
    1. Select your Azure subscription and the Resource group to which you deployed resources using the ARM template.
    2. Select the Web App created for the administration project.
    3. Click OK.
  6. Visual Studio downloads the publishing profile and deploys the Xperience administration project.

After the deployment has completed:

  1. Check that the project is correctly connected to the database (the database installation wizard does not appear).
  2. Add a new licenses for both domains in the License keys application.
  3. In the Sites application, set Administration domain name to the domain of the administration Web App and Presentation Url to the full URL of the MVC Web App.

Publishing the MVC application

  1. Open the MVC project's solution in Visual Studio.
  2. Right-click the project in the Solution Explorer and select Publish....
  3. Select Microsoft Azure App Service and choose Select Existing.
  4. Click Publish.
  5. In the publishing wizard:
    1. Select your Azure subscription and the Resource group to which you deployed resources using the ARM template.
    2. Select the Web App created for the MVC project.
    3. Click OK.
  6. Visual Studio downloads the publishing profile and deploys the MVC project.

After the deployment of both applications has finished:

Post-deployment scenarios

Increasing the storage capacity of deployed Web Apps

By default on Azure Web Apps, all files are stored in the file system with the application. If you need to increase your storage capacity, you have the following options:

  • Raise the Web App's hosting plan tier, which increases the available storage capacity. 
  • Set up a separate Azure Blob Storage account and store select files there. For example, we recommend storing folders containing media library files, form attachments, or other folders likely to grow in size due to visitor contribution or content editor activity.

Storing specific files on Azure Blob Storage

  1. Proceed according to Mapping files to Azure storage.
  2. Re-deploy your project.

Notes:

  • Links will be different for files in the file system and files located on the Blob Storage. Files extant prior to the switch to blob storage remain stored in their original location.
  • Everything else apart from the mapped files will be stored on the Web App's file system.

Was this page helpful?