---
title: Developing Azure projects locally
related:
  - https://docs.kentico.com/k8/running-kentico-on-windows-azure/architecture-of-windows-azure-environment.md
  - https://docs.kentico.com/k8/running-kentico-on-windows-azure/windows-azure-project-development-lifecycle.md
---

> 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).

You can start developing the application in the local computing emulator provided by Azure SDK. You can use the emulator to test the website during its development without actually hosting it in the cloud.

You can use either a standard SQL database or Windows Azure SQL Database (note that when developing locally with a database in the cloud, you may experience slower performance based on the location of the server and database services). However, we recommend that you use a Windows Azure Storage account as a file system for your project.

## Developing Azure projects locally in the emulator

1. Prepare an SQL database or prepare a database on Windows Azure:
   1. [Create new Windows Azure SQL Server](https://docs.kentico.com/k8/running-kentico-on-windows-azure/preparing-the-cloud-environment.md#creating-a-windows-azure-sql-server).
   2. [Add firewall rules for the server](https://docs.kentico.com/k8/running-kentico-on-windows-azure/preparing-the-cloud-environment.md#adding-firewall-rules-for-a-server).
   3. [Create SQL Database](https://docs.kentico.com/k8/running-kentico-on-windows-azure/preparing-the-cloud-environment.md#creating-a-windows-azure-sql-database).
2. [Create a Windows Azure Storage account](https://docs.kentico.com/k8/running-kentico-on-windows-azure/preparing-the-cloud-environment.md#creating-a-windows-azure-storage) through the Windows Azure Management Portal.
3. Open your Azure project in Visual Studio using the **CMSAzure.sln** file.
4. Right-click the **CMSAzure/Roles/CMSApp** role and select **Properties**.
5. Switch to the **Settings** tab.
6. Select **Local** as the Service Configuration.
7. Set the value of **CMSConnectionString** key to the connection string for your database.
   - You can find the connection string of Windows Azure SQL Database on the [Windows Azure Management Portal](https://manage.windowsazure.com/) in **SQL Databases ->** select the database **-> Dashboard** tab **-> Show connection strings** link.
8. Set the values of **CMSAzureAccountName** and **CMSAzureSharedKey** keys for your Azure Storage.
   - You can find these values on the [Windows Azure Management Portal](https://manage.windowsazure.com/) in **Storage ->** select your storage **-> Manage access keys** (in the bottom panel) as **Storage account name** and **Primary access key**.
9. Clear the values of **CMSAzureQueueEndPoint**, **CMSAzureTableEndPoint** and **CMSAzureBlobEndPoint** keys.

   ![Configuring the CMSApp role for local development](https://docs.kentico.com/docsassets/k8/developing-azure-projects-locally/CMSApp_local_settings.png "Configuring the CMSApp role for local development")
10. Repeat steps 4 - 9 for the **SmartSearchWorker** role.
11. Right-click the **CMSAzure** project in the Solution Explorer and select **Set as StartUp Project**.
12. Run the project in the debug mode.
13. Go through the Kentico database installation when the system automatically opens the database installation in a browser.
    - In case of Windows Azure SQL Server, use the following format of the server name: _servername.database.windows.net_.

      ![Windows Azure SQL Server settings](https://docs.kentico.com/docsassets/k8/developing-azure-projects-locally/SQL_server_settings.png "Windows Azure SQL Server settings")

Your web project is now prepared to be developed on your local computer.

## Developing Azure projects locally as web applications

If you are having trouble running your project in the local emulator, you can develop your Azure project as a normal web application project. We recommend this approach only if you do not plan to perform any customizations specific to Windows Azure environment.

1. Prepare an SQL database or [create new Windows Azure SQL Server](https://docs.kentico.com/k8/running-kentico-on-windows-azure/preparing-the-cloud-environment.md#creating-a-windows-azure-sql-server) and [SQL Database](https://docs.kentico.com/k8/running-kentico-on-windows-azure/preparing-the-cloud-environment.md#creating-a-windows-azure-sql-database).
2. [Create a Windows Azure Storage account](https://docs.kentico.com/k8/running-kentico-on-windows-azure/preparing-the-cloud-environment.md#creating-a-windows-azure-storage) through the Windows Azure Management Portal.
3. Open your Azure project in Visual Studio using the **WebApp.sln** file.
4. Open the **CMSApp\Web.config** file.
5. Add the **CMSConnectionString** key and value to the \<connectionStrings> section of the web.config file.

   ```xml

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

   ```

   - Replace **YourServerName**, **YourDatabaseName**, **YourUsername** and **YourPassword** with your own values.
   - You can find the connection string of Windows Azure SQL Database on the [Windows Azure Management Portal](https://manage.windowsazure.com/) in **SQL Databases ->** select the database **-> Dashboard** tab **-> Show connection strings** link.
6. Add the **CMSAzureAccountName** and **CMSAzureSharedKey** keys to the \<appSettings> section of the web.config file.

   ```xml

   <appSettings>
       ...
       <add key="CMSExternalStorageName" value="azure" />
       <add key="CMSAzureAccountName" value="YourStorageAccountName" />
       <add key="CMSAzureSharedKey" value="YourPrimaryAccessKey" />
   </appSettings>

   ```

   - Replace **YourStorageAccountName** and **YourPrimaryAccessKey** with your own values.
   - You can find these values on the [Windows Azure Management Portal](https://manage.windowsazure.com/) in **Storage ->** select your storage **-> Manage access keys** (in the bottom panel) as **Storage account name** and **Primary access key**.
7. Right-click the **CMSApp** project in the Solution Explorer and select **Set as StartUp Project**.
8. Right-click the **CMSApp\_AppCode\Old\_App\_Code\CMSModules\WindowsAzure** folder and select **Exclude From Project**.
9. Run the project in the **debug** mode.
10. Go through the Kentico database installation when the system automatically opens the database installation in a browser.
    - In case of Windows Azure SQL Server, use the following format of the server name: _servername.database.windows.net_.

You can now develop your project as a standard web application project.

## Deploying locally developed Azure projects

When you are ready, you can move your locally developed Azure project to the production environment while still being able to make changes to the project locally. For this scenario to work, you must use only **one instance** of the CMSApp web role.

> **Note:** **WindowsAzure folder**
>
> If you are developing your project locally as a web application, you need to return the WindowsAzure folder to your project before the deployment. The folder contains the AzureInit.cs file, which is essential for running your project on Microsoft Azure.
>
> 1. Open your Azure project in Visual Studio using the **CMSAzure.sln** file.
> 2. Select **Show all files** on the Solution Explorer panel.
>    - This option displays folders and files which are excluded from the project.
> 3. Open the **CMSApp\_AppCode\Old\_App\_Code\CMSModules** folder.
> 4. Right-click the **WindowsAzure** folder and select **Include in project**.
>
> The system includes the AzureInit.cs file back into the project.

### Deployment with migration to a new database

This procedure presumes that you used a local SQL database and you want to migrate the database to the Windows Azure SQL Database.

1. Export your website from Kentico database in **Sites** application **-> Export site**.
2. [Create Cloud Service](https://docs.kentico.com/k8/running-kentico-on-windows-azure/preparing-the-cloud-environment.md#creating-a-windows-azure-cloud-service).
3. [Create new Windows Azure SQL Server](https://docs.kentico.com/k8/running-kentico-on-windows-azure/preparing-the-cloud-environment.md#creating-a-windows-azure-sql-server).
4. [Create SQL Database](https://docs.kentico.com/k8/running-kentico-on-windows-azure/preparing-the-cloud-environment.md#creating-a-windows-azure-sql-database).
5. Open your Azure project in Visual Studio using the **CMSAzure.sln** file.
6. In **Properties** of the **CMSApp** web role, on the **Settings** tab, in the **Cloud** service configuration, fill the **CMSAzureAccountName** and **CMSAzureSharedKey** keys with appropriate values for your Azure Storage (the same as for the Local configuration).
7. Set the **CMSConnectionString** value with the connection string of the new database.
8. [Configure the SmartSearchWorker role](https://docs.kentico.com/k8/running-kentico-on-windows-azure/configuring-an-azure-project.md#configuring-smart-search).
9. [Deploy your project to the created Cloud Service](https://docs.kentico.com/k8/running-kentico-on-windows-azure/deploying-an-azure-project.md).

   - Make sure that the **Enable Remote Desktop for all roles** and **Enable Web Deploy for all web roles (requires Remote Desktop)** are selected.
10. Install a new database for your project.
11. Import the previously exported website in **Sites** application **-> Import site or objects**.

Now you can deploy changes to the project files quickly using the [Web deploy](#web-deploy) functionality.

### Deployment when using the same database

This procedure presumes that you are using the Windows Azure SQL Database from the beginning and you do not need to migrate the database.

1. [Create Cloud Service](https://docs.kentico.com/k8/running-kentico-on-windows-azure/preparing-the-cloud-environment.md#creating-a-windows-azure-cloud-service).
2. Open your Azure project in Visual Studio using the **CMSAzure.sln** file.
3. In **Properties** of the **CMSApp** web role, on the **Settings** tab, in the **Cloud** service configuration, fill the **CMSAzureAccountName** and **CMSAzureSharedKey** keys with appropriate values for your Azure Storage (the same as for the Local configuration).
4. Set the **CMSConnectionString** value with the connection string of your database (the same as for the Local configuration).
5. [Configure the SmartSearchWorker role](https://docs.kentico.com/k8/running-kentico-on-windows-azure/configuring-an-azure-project.md#configuring-smart-search).
6. [Deploy your project to the created Cloud Service](https://docs.kentico.com/k8/running-kentico-on-windows-azure/deploying-an-azure-project.md).

   - Make sure that the **Enable Remote Desktop for all roles** and **Enable Web Deploy for all web roles (requires Remote Desktop)** options are selected.

Now you can deploy changes to the project files quickly using the [Web deploy](#web-deploy) functionality.

### Web Deploy

If you are performing web deploy from the **same computer** from which you performed the initial deployment, this procedure is straightforward as you can use an already created publish profile:

1. Right-click the **CMSApp** project and select **Publish**.
2. Select the existing publish profile from the drop-down list.
3. Switch to the **Connection** tab.
4. Provide the password for remote desktop connection.
5. Click **Publish**.

If you are performing web deploy from a **different computer** than the one from which you performed the initial deployment, you need to create a new publish profile:

1. Right-click the **CMSApp** project and select **Publish**.
2. Click the drop-down list and select \<New profile...>.
3. Type the name of the profile and click **OK**.
4. On the **Connection** tab, select **Web Deploy** as the Publish method.
5. Provide the **Server** address:

   1. Open [Windows Azure Management Portal](https://manage.windowsazure.com/) in a browser.
   2. Select **Cloud services ->** your cloud service **-> Dashboard** tab.
   3. Copy the **Site URL** without the protocol (http://) and trailing slash (/) to the Server field of the web deploy profile in the following format:

      ```text

      https://YourSiteURL:8172/MsDeploy.axd

      ```
6. Provide the **Site name**:

   - This corresponds to the name of your website registered in IIS of the server.
   - You can find the name by remotely connecting to the server (**Cloud services ->** your cloud service **-> Instances** tab -> Click **Connect** in the bottom panel and run the downloaded file).
   - The default value is **CMSApp\_IN\_0\_Web**.
7. Type the username and password for remote desktop connection.

   ![Configuring Web Deploy for Azure projects](https://docs.kentico.com/docsassets/k8/developing-azure-projects-locally/Web_deploy.png "Configuring Web Deploy for Azure projects")
8. Switch to the **Settings** tab.
9. Choose the build Configuration.
10. Click **Publish**.

## Final deploy

When your project is fully developed and ready to go live, [Deploy your project](https://docs.kentico.com/k8/running-kentico-on-windows-azure/deploying-an-azure-project.md) again, with the **Enable Remote Desktop for all roles** and **Enable Web Deploy for all web roles (requires Remote Desktop)** options CLEARED. After that, your CMSApp web role can use more than one instance.
