Setting up Kentico in Azure Web Apps

The following scenarios describe how to create a new Kentico website as an Azure Web Apps service. You have the following options:

Creating Azure Web Apps from the Microsoft Azure Marketplace

You can find a Kentico CMS package in the Azure marketplace. Creating new web apps using the provided template is quick and easy.

Limitations

The Kentico CMS package on the Azure Marketplace is intended mainly for evaluation purposes. To develop fully qualified websites, we recommend installing and deploying Kentico from a local environment, which gives you full control over the project's source files and all ancillary Kentico features (such as applying hotfixes).

Additionally, the package is not suitable if you wish to use the MVC development model (it only provides the administration application, without the MVC live site). In this case, we recommend installing the required projects locally and then deploying them to Azure.

  1. Open the Azure Management Portal.
  2. Click Create a resource -> Web + Mobile.
  3. Click See all and search for Kentico CMS.
  4. Select Kentico CMS from the list of results and click Create on the newly opened tab.
  5. Type the URL (name) of your web app.
  6. Select a Resource Group.
  7. Set your preferred App Service plan.
  8. Select an existing or create a new SQL database and server.
    Creating a Kentico instance in Azure Web Apps
  9. Click Create.
On this page



Database installation

  1. Access the created website.
  2. Provide the server name and credentials for the server where you created the database.
  3. Click Next.
  4. Select Use an existing database and type the name of the database created for the website.
  5. Click Next.
  6. Click Next without filling in any fields.
  7. Select Create a new site or import an existing Kentico site and click Next.
    • The installer redirects you to the Kentico administration interface.
  8. Switch to the Licenses tab and add the license for the website domain.

Perform the following final configurations:

Creating Azure Web Apps from Visual Studio

This scenario presumes that you already have a Kentico project installed on a local computer and you want to deploy it to an Azure Web App service using Visual Studio. You can also create the Web App service directly from Visual Studio.

Deploying MVC sites

For sites created using the MVC development model, 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). However, the database is shared – only create the database once and then use the same connection string in both projects.

  1. Open your project in Visual Studio.
  2. Open the Server Explorer.
  3. Expand the Azure section, right-click App Service, and select Create New App Service...
    • The Create App Service dialog 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.

    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

  8. Click Create a new SQL Database and create a new database for the application.
    1. Enter the name of the database.
    2. Select an existing or create a new SQL server.
    3. Provide administrator credentials for the server.
    4. Set the Connection String Name field to CMSConnectionString.
    5. Click OK.
      Creating a new SQL Database
  9. Back in the main dialog window, click Create.

Visual Studio creates the App Service. Continue by adjusting the configuration of your project's web.config file:

  1. Right-click the created web app (you might need to refresh the App Service section for the app to appear) and select View settings.
  2. Copy the connection string value and paste it to the web.config file of your project.

    <connectionStrings>
        <add name="CMSConnectionString" connectionString="Data Source=tcp:YourServerName.database.windows.net,1433;Initial Catalog=YourDatabaseName;User Id=YourUsername@YourServerName;Password=YourPassword;" />
    </connectionStrings>

    Replace YourServerNameYourDatabaseNameYourUsername and YourPassword with your own values.

    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. To set the connection string for the web app, change the defaultConnection name to CMSConnectionString.

  3. Make sure that the sessionState mode is set to InProc in the web.config file.

    <sessionState mode="InProc" />

    Use InProc mode if you plan to use only one instance of the Web App service. If you want to scale your web app to more instances, you need to configure the session state differently. See Storing session state data in an Azure environment.

You can now deploy the project:

  1. Right-click the project in the Solution Explorer and select Publish (or Publish Web App).
    • Publish dialog opens.
  2. Click Microsoft Azure App Service.
  3. Select the created web app located under the resource group you specified.
  4. Click OK.
  5. Do not modify the default settings.
    Publishing the Web App
  6. Click Publish.
  7. Once the publishing process is finished, Visual Studio automatically opens the base URL of your project in your default browser. Follow the on screen wizard to complete the database installation.

Once everything is set up, we recommend you perform the following configuration:

Uploading Kentico to Azure Web Apps over FTP

This scenario presumes that you already have a Kentico project installed on a local computer and you want to deploy it to the Azure Web App service over FTP. Uploading Kentico projects to Azure Web Apps through a FTP client is easy, but it can take a lot of time, so we recommend using a reliable client, for example FileZilla.

You also need to create the Web Apps service first, through the Azure Management Portal.

Deploying MVC sites

For sites created using the MVC development model, 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). However, the database is shared – only create the database once and then use the same connection string in both projects.

Creating Azure Web Apps through the Azure Management Portal

  1. Open the Azure Management Portal.
  2. Open Create a resource -> Web + Mobile -> Web App + SQL -> Create.
  3. Enter the URL (name) of the web app.
  4. Select the Azure subscription under which the Web App will be created.
  5. Select an existing Resource Group or create a new one.
  6. Select an existing Hosting plan or create a new one.

    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.

  7. Select an existing SQL database and server or create a new one.
  8. Click Create.

The system creates a new Web App service and an Azure SQL database.

Uploading Kentico to Azure Web Apps over FTP

When you have created a Web App service, you can upload your Kentico project over an FTP connection. You can also upload just updated files over FTP after the deployment.

  1. Open the Azure Management Portal.
  2. Select your web app on the App Services tab.
  3. Switch to the Deployment credentials tab.
  4. Enter a user name and password and click OK.
  5. Use the FTP host name and Deployment / FTP User information displayed on the application's Overview tab to configure your FTP client.
    Setting up an FTP connection to a created Web App
  6. Upload the file content of your project to the site\wwwroot folder on the Web App file system.
    • For Kentico projects, copy the CMS folder.
    • For MVC live site projects, copy the sub-folder containing the project's files (the name and location depends on your development environment and site name).

When the copying is finished, open the website and finish the database installation.

Perform the following final configurations:


Was this page helpful?