---
title: Deploying existing Portal Engine projects to Azure Web Apps
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

If you already have a Kentico website hosted on a traditional web server or prepared for deployment, you can decide to move your project to Azure Web Apps.

This scenario assumes that you have a Kentico project installed in a local file system, connected to a standard Microsoft SQL database. If you want to move your project to Azure Web Apps, you need to:

1. [Deploy your database to Azure SQL](#part-1---deploying-the-database-to-azure) (if you want to have the whole project on Azure, otherwise it is not necessary)
2. [Create a new Azure Web Apps application](#part-2---creating-azure-web-apps-from-visual-studio).
3. [Deploy the project files through Visual Studio](#part-3---deploying-projects-to-azure-web-apps). Alternatively, you can also [deploy your project over FTP](https://docs.kentico.com/k12sp/deploying-websites/running-kentico-on-microsoft-azure/running-kentico-in-azure-web-apps/setting-up-kentico-in-azure-web-apps.md).

However, please read the **Possible issues** section first and adjust your project according to the recommendations.

## Possible issues

The following issues present problems which you should be aware of during the process of deploying an existing project to an Azure Web Apps project. Please assess whether they apply to your project and adjust your project according to the recommendations.

- If you have set up a manual **web farm** in your project, the system may contain unnecessary web farm servers in the database. Therefore, we recommend that you delete the old web farm servers in the UI to ensure that a licensing error does not occur. And configure the web farms to generate web farm servers automatically.
- If you are deploying a **web application** project and you **store virtual objects** (form layouts, page layouts, transformations, etc.) in the file system (when the **System -> Virtual objects -> Store all virtual objects in file system** option is enabled), the virtual objects may not be deployed together with the project. Either move the objects back to the database or include the object files in the project (as described in [Deployment mode on web application projects](https://docs.kentico.com/k12sp/deploying-websites/deployment-mode-for-virtual-objects.md#deployment-mode-on-web-application-projects)) before deploying your project to the Azure platform. Kentico web site projects do not require any actions in this regard.
- 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.

## Part 1 - Deploying the database to Azure

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.

To learn how to deploy on-premise databases to Azure SQL Database, see the [SQL Server database migration to SQL Database in the cloud](https://docs.microsoft.com/en-us/azure/sql-database/sql-database-cloud-migrate) article.

For example, you can use the following steps to deploy your database using the _Deploy Database to Microsoft Azure Database_ wizard in SQL Server Management Studio:

1. Create an Azure SQL Database Server:
   1. Open the [Azure Management portal](https://portal.azure.com/).
   2. Click **Create a resource ->** **Databases -> SQL Database**.
   3. Fill in the SQL Database form:

      1. Enter the database name.
      2. Select your Azure subscription.
      3. Select a Resource Group for the database or create a new one.
   4. Click **Server** and fill in the SQL server (logical server) form to create a new Azure SQL database server:

      1. Enter the server name.
      2. Specify the server admin credentials.
      3. Select your Azure subscription.
      4. Select a Resource Group for the server or create a new one.
      5. Select the location of your database. We recommend using the same location for all created services.
      6. Ensure that **Allow Windows Azure services to access the server** is selected. This option adds special firewall rules to allow your deployed Kentico projects to access the server and its databases.
      7. Create the Azure SQL server.
   5. Select a [pricing tier](https://azure.microsoft.com/en-us/pricing/details/sql-database/) for the database.
   6. Use the default _SQL\_Latin1\_General\_CP1\_CI\_AS_ database collation.
   7. **Create** the database.
2. Configure the SQL server's firewall rules:
   1. Select the server.
   2. Switch to the **Firewall** tab.
   3. Create a new access rule for the IP ranges of your development and administration machines.
3. Deploy your SQL server according to the instructions in the [SQL Server database migration to SQL Database in the cloud](https://docs.microsoft.com/en-us/azure/sql-database/sql-database-cloud-migrate) article.
4. Change the connection string in the **web.config** file of your Kentico projects to connect to the deployed Azure SQL database. You can use the following template:

   ```xml

   <connectionStrings>
       <add name="CMSConnectionString" connectionString="Server=DATABASE_SERVER.database.windows.net;Database=DATABASE_NAME;User ID=DB_SERVER_USER_NAME;Password=DB_SERVER_PASSWORD;Trusted_Connection=False;Encrypt=True;Connection Timeout=120" />
   </connectionStrings>

   ```

   Replace the upper-case placeholder words with your own data.

You have deployed your database to the Azure SQL database. Proceed with creating a new Azure Web Apps service.

## Part 2 - Creating Azure Web Apps from Visual Studio

Before you can deploy your project, you need to create a new Azure Web Apps service. You can do this from the [Microsoft Azure management portal](https://portal.azure.com) or directly from Visual Studio:

> **Note:** **Deploying MVC sites**
>
> For sites created using the [MVC development model](https://docs.kentico.com/k12sp/developing-websites/mvc-development-overview.md), you need two Web App services – one for the MVC live site project and another for the Kentico administration project. Perform the following steps separately for both projects.

1. Open your Kentico project in Visual Studio.
2. Open the **Server Explorer**.
3. Expand the **Azure** section, right-click **App Service**, and select **Create New App Service...**

   - A **Create App Service** window opens.
4. Enter the web app name (the resulting URL of your application).
5. Select the Azure subscription under which the Web App will be created.
6. Select an existing Resource Group or create a new one.
7. Select an existing Hosting plan or create a new one.

   > **Tip:** For MVC sites, we strongly recommend using two different hosting plans – one for the MVC live site application and another for the Kentico administration application. This allows you to scale the applications independently. In most cases, the MVC live site will receive the bulk of the traffic and have different performance requirements than the administration interface.

   ![Creating an App Service in Visual Studio 2017](https://docs.kentico.com/docsassets/k12sp/deploying-existing-portal-engine-projects-to-azure-web-apps/CreateAppServiceDatabaseIncluded.png "Creating an App Service in Visual Studio 2017")
8. Click **Create**.

You can view the newly created web app in the [Azure management portal](https://portal.azure.com/) under Web Apps. You can now deploy your project to Azure Web Apps.

## Part 3 - Deploying projects to Azure Web Apps

For sites created using the [MVC development model](https://docs.kentico.com/k12sp/developing-websites/mvc-development-overview.md), you need to perform the deployment process for **both** the MVC live site project and the Kentico administration project (using a separate Web App service for each project).

> **Note:** **Including files in web application projects**
>
> If you are deploying a _web application_ project, do not forget to include added files to the project. For example media library folders or files, script files, stylesheets, etc.
>
> To add files to a project, enable the **Show All Files** option in the Solution Explorer menu, locate the file, right-click the file and select **Include in project**. This ensures that the files are deployed along with the project.

1. Open your project in Visual Studio.
2. Open the web.config file and make sure that the _sessionState_ mode is set to **InProc**.

   ```xml

   <sessionState mode="InProc" />

   ```

   Use _InProc_ mode if you plan to use one instance of the Web App service. If you want to scale your web app to more instances, you will need to configure the session state differently. See [Storing session state data in an Azure environment](https://docs.kentico.com/k12sp/deploying-websites/running-kentico-on-microsoft-azure/storing-session-state-data-in-an-azure-environment.md).
3. Right-click the project in the Solution Explorer and select **Publish...** (or **Publish Web App**).
4. Select **Microsoft Azure App Service**.
5. Select the previously created web app in the drop-down list.
6. Click **OK**. The system downloads the publish profile.
7. Leave the settings as they are.
8. Click **Publish**.

The system deploys your project to the Azure Web App service. Check that the project is correctly connected to the database (the database installation dialog does not appear) and add a new license for your domain in the Licenses application.

After that, proceed to performing the following final configurations

- [Adjust the web hosting plan mode](https://docs.kentico.com/k12sp/deploying-websites/running-kentico-on-microsoft-azure/running-kentico-in-azure-web-apps/adjusting-the-web-hosting-plan-mode-on-azure-web-apps.md) on your web app.
- Configure the tier of your Azure SQL database according to our [recommendations](https://docs.kentico.com/k12sp/deploying-websites/running-kentico-on-microsoft-azure/recommendations-on-using-azure-sql-database-tiers.md).
- For MVC sites, make sure your live site and administration apps are configured to use the same server time zone. See [Changing the server time zone on Azure Web Apps](https://blogs.msdn.microsoft.com/tomholl/2015/04/06/changing-the-server-time-zone-on-azure-web-apps/).

After that, your Kentico project is ready to run in Azure Web Apps.

## Increasing storage capacity on Azure Web Apps

By default on Azure Web Apps, all files are stored in the file system with the application, including the media files. The capacity of the storage space is limited – the Basic plan has 10 GB storage available, see [Websites Limits](https://docs.microsoft.com/en-us/azure/azure-subscription-service-limits) for details. When you exceed the capacity, for example by uploading large media files, you have the following options:

- Raise the web hosting plan's pricing tier to Standard, which has 50 GB of storage.
- Configure your system to use Azure Blob Storage and store the media files there.

See [Increasing storage capacity on Azure Web Apps](https://docs.kentico.com/k12sp/deploying-websites/running-kentico-on-microsoft-azure/running-kentico-in-azure-web-apps/increasing-storage-capacity-on-azure-web-apps.md) for instructions.

## Configuring web farms for Azure Web Apps

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 [Enabling web farms on Azure Web Apps](https://docs.kentico.com/k12sp/deploying-websites/running-kentico-on-microsoft-azure/running-kentico-in-azure-web-apps/enabling-web-farms-on-azure-web-apps.md) for instructions.
