Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
Kentico 9
1. Running Kentico on Microsoft Azure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.1 Microsoft Azure web hosting options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.2 Running Kentico in Azure Web Apps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2.1 Setting up Kentico in Azure Web Apps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51.2.2 Deploying existing Kentico projects to Azure Web Apps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101.2.3 Migration of Kentico projects from Azure Cloud Services to Azure Web Apps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131.2.4 Adjusting the web hosting plan mode on Azure Web Apps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151.2.5 Increasing storage capacity on Azure Web Apps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151.2.6 Enabling web farms on Azure Web Apps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161.2.7 Azure Web Apps problematic folders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.3 Running Kentico in Azure Cloud Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171.3.1 Architecture of Microsoft Azure Cloud Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181.3.2 Requirements and limitations for running Kentico in Azure Cloud Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191.3.3 Lifecycle for developing Kentico projects in Azure Cloud Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201.3.4 Preparing the Azure cloud environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211.3.5 Installing Kentico Azure projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251.3.6 Configuring Kentico Azure projects for Cloud Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261.3.7 Deploying Azure projects to Cloud Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331.3.8 Installing the database for Azure projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341.3.9 Developing Kentico Azure projects locally . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391.3.10 Scaling Azure Cloud Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451.3.11 Converting an existing project to an Azure project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451.3.12 Troubleshooting Azure projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
1.4 Developing for Microsoft Azure Cloud Services - best practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521.5 Configuring Azure CDN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581.6 Mapping the Web analytics storage folder to the server file system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591.7 Preventing Azure cache folders from bloating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 601.8 Recommendations on using Azure SQL Database tiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 621.9 Storing cache and session state data in Azure environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 621.10 Troubleshooting Smart search on Azure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Running Kentico on Microsoft AzureMicrosoft Azure is a cloud platform for hosting and managing applications and services.
When you want to host your project on Microsoft Azure, you first need to decide which is the most suitable for you. To decidehosting optionif you will host your project in Azure Web Apps, Azure Cloud Services or Azure Virtual Machines, see:
Microsoft Azure web hosting optionsor view the Microsoft Azure documentation: . Compute Hosting Options Provided by Azure
Depending on the chosen option, continue to the specific section of the :documentation
Running Kentico in Azure Web AppsRunning Kentico in Azure Cloud ServicesWe do not provide documentation for Azure Virtual Machines as the procedure is similar to running Kentico on a normal server.
Note that there are crucial differences between the that you are required to install for each particular hosting option:project types
Azure Web Apps - require deployment of web application or website projects.Azure Cloud services - require deployment of Azure projects.
Azure Blob Storage
If you are looking for information on how to connect your Kentico project to Azure Blob Storage, without running Kenticoapplication on Azure, see .Configuring Azure storage
Running Kentico on Microsoft AzureMicrosoft Azure web hosting optionsRunning Kentico in Azure Web AppsRunning Kentico in Azure Cloud ServicesDeveloping for Microsoft Azure Cloud Services - best practicesConfiguring Azure CDNMapping the Web analytics storage folder to the server file systemPreventing Azure cache folders from bloatingRecommendations on using Azure SQL Database tiersStoring cache and session state data in Azure environmentTroubleshooting Smart search on Azure
Microsoft Azure web hosting optionsMicrosoft Azure provides three main cloud solutions where you can host your Kentico applications. Each of them has its own benefits anddrawbacks, and they differ mainly in the amount of control they offer you over the site and machine.
Web Apps - least control, easy managementCloud Services - moderate control, moderate managementVirtual Machines - most control, demanding management
You can run Kentico in all three hosting platforms. When deciding the particular platform which you want to use for your project on, considerthe you will need, as well as the you are prepared to spend on maintaining the machineamount of control amount of maintenance workinfrastructure.
Azure web hosting options
Azure Web Apps
Azure Web Apps (previously known as Azure Websites, ) are quick to create and easy to set up and manage. However, they dosee detailsnot offer as many customization options as the other two options.
You can deploy your application to Web Apps through several ways (FTP, Git, ). However, you will never have directVisual Studio, etc.server access.
Projects can be either websites or web applications, and can run on multiple versions of .NET. Deployment of changes is done via FTP orWeb Deploy, so the changes are easily rolled out and applied to the application. This makes Kentico development a fast and simple processwhere changes can be completed and deployed from within Visual Studio. You can also utilize an integration to an online source control(Visual Studio Online, GitHub, Bitbucket, etc.).
Azure Cloud Services
Cloud Services was the first option to which you could deploy your application before the other options were introduced.
The main disadvantage of this platform is that you need to set your application as Kentico Azure project (or convert a web application projectto Azure project) prior to deployment. Additionally, you need to package your application as a and then deploy it to the cloud. Azuresnapshotpulls from this to create the application. This creates a scenario where every change to the application requires a full deployment, asnapshot
daunting task for a large Kentico application.
Therefore, we believe that this model is now outdated and that you should rather consider using Azure Web Apps because of a quickerdeployment process.
Azure Virtual Machines
With Azure Virtual Machines, you can choose from a gallery of images for the virtual machine operating system. Microsoft provides optionsfor Windows, Linux, Ubuntu, CoreOS, and others. Developers have the option to choose nearly any configuration of SQL Server, BizTalkServer, or even Visual Studio for a cloud-hosted development machine.
Kentico applications that require a lot of customization may benefit from a Virtual Machines deployment because the developer has the abilityto control every aspect of the environment. Changes to the code can be deployed for example using Visual Studio or through other ways.Additionally, complex services and integrations can be easily managed via remote desktop. Also, legacy Kentico applications that cannot beconverted to a web application can easily be set up on the desired OS and managed like an on-premise solution.
Comparison from Kentico perspective
Web Apps Cloud Services Virtual Machines Note
Scalability support auto-scaling support auto-scaling additional networkingconfiguration required
You need to configure webfarms in Kentico to ensurescalability. Please seeindividual sections in thedocumentation.
Machine access no remote desktopaccess
remote desktop access,without server administration
complete control of OSand environment
Defines the level of accessyou have over the cloudcomputer your application isrunning on.
Machine management no maintenance isrequired
no maintenance isrequired
configuring, patching,and maintaining theoperating system is required
Setting up fastest deploymentmodel
lengthy configurationand deployment process forKentico applications
lengthy configuration ofthe virtual machine
Deploying changes quick - Web Deploy complete deploymentrequired
quick - Web Deploy
Deployment slots for thefile system
deployment slotsavailable
staging deployment slot Cloud Services: you canuse the Staging deploymentslot to deploy a new versionof your website and aftertesting it, you can swap thestaging website with theproduction website.
Project type website or webapplication
Kentico Azure project(or web application)
website or webapplication
Migrating a project fromCloud Services to Web Appsis easy. The other wayaround is more difficult.
Smart search no special configurationrequired
a special worker role forsmart search must beconfigured and running
no special configurationrequired
Requires Azure BlobStorage(can present potentialproblems)
no (but possible) yes no (but possible)
Kentico WindowsServices(Kentico CMS HealthMonitor and Kentico CMSScheduler)
not possible possible possible
Startup tasks not possible possible possible
Documentation Running Kentico in AzureWeb Apps
Running Kentico in AzureCloud Services
We do not providedocumentation for VirtualMachines, as you manageKentico in a virtual operatingsystem, which is similar tohosting Kentico on a server.
1. 2. 3. 4. 5. 6. 7.
Conclusion
We recommend that you consider Azure Web Apps as the first cloud option for you applications.
Only if you necessarily need a remote desktop access to the computing machine or you need the Windows Services and startup tasks to berunning, should you consider using the Azure Virtual Machines or Azure Cloud Services instead.
Other useful and related sources
Official Microsoft Azure documentation
Azure App Service, Cloud Services, and Virtual Machines comparison
DevNet articles
Deploying Kentico to Microsoft Azure – Know your web hosting options
Deploying Kentico to Microsoft Azure – Know your database options
Running Kentico in Azure Web AppsMicrosoft (previously known as Azure Websites, ) is a service which allows you to create and host websites inAzure Web Apps see detailsthe cloud.
Azure Web Apps are quick to create and easy to set up and manage. However, they do not offer as many customization options as AzureCloud Services. For a more detailed comparison, see on MSDN.Azure Websites, Cloud Services and Virtual Machines comparison
When setting up Kentico in Azure Web Apps, you might utilize one of the following scenarios:
You want to create Kentico and you have decided to host it in Azure Web Apps. website from scratchSee .Setting up Kentico in Azure Web Apps
You have a Kentico website and you decide to host it in Azure Web Apps. already developed See .Deploying existing Kentico projects to Azure Web Apps
You have a Kentico website hosted in and you decide to move it to Azure Web Apps. Azure Cloud ServicesSee .Migration of Kentico projects from Azure Cloud Services to Azure Web Apps
Setting up Kentico in Azure Web AppsThis scenario expects that you want to create a new Kentico website in Azure Web Apps service (renamed from Azure Websites, )see details. You can create a new Kentico website:
From the Web Application GalleryFrom Visual StudioCreate a Web App through the Azure Management Portal and deploy Kentico over FTPSee other options of deploying Kentico to Azure Web Apps in Microsoft documentation
Creating Azure Web Apps from Web Application Gallery
You can find a Kentico package in the application gallery. Creating new web apps using the provided template is quick and easy.
Open the .Azure Management PortalClick .New -> Compute -> Web App -> From gallerySelect .Kentico CMS for ASP.NETClick Next.Type the URL (name) of your web app.Choose to create a new SQL database.Choose a region (location) for your web app.
Azure Cloud Services
This section is about Azure Web Apps. If you are interested in the alternative hosting option, , see Azure Cloud Services Running section. Or first see the page.Kentico in Azure Cloud Services Microsoft Azure web hosting options
7.
8. 9.
10. 11.
1. 2. 3. 4. 5. 6. 7.
8.
1. 2.
3.
Click Next.Type the name of the databaseCreate a new server or choose an existing server for the database and provide login credentials.Complete the creation.
Database installation
Access the created website.Provide the server name and credentials for the server used to create the database in.Click .NextSelect and type the name of the database created for the website.Use an existing databaseClick .NextClick without filling any field.NextSelect and click .Import existing Kentico CMS website Next
The installer redirects you to the administration interface.Switch to the tab and add the license for the website domain.Licenses
Proceed to performing the following final configurations:
on your web appAdjust the web hosting plan mode .Configure the tier of your Azure SQL database according to our .recommendations
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 the Azure WebApp service using Visual Studio. You can also create the Web App service directly from Visual Studio.
Open your Kentico project in Visual Studio.Open the tab (or Database Explorer tab in Express editions of Visual Studio).Server Explorer
In Microsoft Visual Studio 2012 and 2013, the service is still called Azure Websites.
3.
4. 5. 6. 7.
8.
1. 2.
3.
Right-click Windows Azure/ and select Web Sites Add New Site...A window opens.Create site on Windows Azure
Type the web app name (URL).Select the location for your web app.Select an existing database server or create a new one.Provide the credentials for the server.
Click .Create
Visual Studio creates the Web App service. Continue with adjusting the configuration of the web.config file and deploying your project.
Right-click the created web app and select .View settingsCopy the connection string value and paste it to the file of your project.web.config
<connectionStrings> <add name="CMSConnectionString" connectionString="DataSource=tcp:YourServerName.database.windows.net,1433;InitialCatalog=YourDatabaseName;UserId=YourUsername@YourServerName;Password=YourPassword;" /></connectionStrings>
Replace , , and with your own values.YourServerName YourDatabaseName YourUsername YourPassword
.Make sure that the sessionState mode is set to in the web.config file.InProc
Configuring the connection string after the deployment
You can also configure the connection string through the in select a web app Azure Management Portal Web Apps -> -> tab section. To set the connection string for the web app, change the Configure -> connection strings DefaultConnectio
name to .n CMSConnectionString
3.
4. 5. 6. 7. 8.
9. 10.
1.
<sessionState mode="InProc" />
Use mode if you plan to use one instance of the Web App service. If you want to scale your web app to more instances, youInProcwill need to configure the session state differently. See .Storing cache and session state data in Azure environment
Right-click the project folder (CMSApp or CMS) in the Solution Explorer and select (or ).Publish Publish Web SiteClick .ImportSelect the created web app in the drop-down list.Click .OKLeave the settings as they are.
Click .PublishWhen the project is published and the website of your project is automatically opened in a browser, complete the databaseinstallation.
Proceed to performing the following final configurations:
on your web appAdjust the web hosting plan mode .Configure the tier of your Azure SQL database according to our .recommendations
Creating Azure Web Apps through the Azure Management Portal and deploying Kentico 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 WebApp 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 werecommend using a reliable client, for example .FileZilla
You also need to create the Web Apps service first, through the Azure Management Portal.
Creating Azure Web Apps through the Azure Management Portal
1. 2. 3. 4. 5. 6.
7. 8. 9.
10.
1. 2. 3. 4. 5. 6.
Open the .Azure Management PortalClick in the bottom panel .New -> Compute -> Web App -> Custom CreateType the of the web app.URLSelect , select your and closest to you.Create new hosting plan subscription regionSelect to .Create a new SQL databaseChange the connection string name to . This allows you to configure the connection stringDefaultConnection CMSConnectionStringin the Azure Management Portal.
Click .NextType the name of the new database.Select an existing server or create a new SQL database server, provide the server credentials and region.Complete the creation.
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 updatedfiles over FTP after the deployment.
Open the .Azure Management PortalSelect your web app on the tab.Web AppsSwitch to the tab.DashboardClick .Set up deployment credentialsType a user name and password and click OK.Use the and information displayed on the dashboard to configure your FTP client.FTP host name Deployment / FTP User
6.
7.
1. 2. 3.
Copy the content of the folder in your Kentico project to the folder on the Web App file system.CMS site\wwwroot
When the copying is finished, open the website and finish the database installation.
Proceed to performing the following final configurations:
on your web appAdjust the web hosting plan mode .Configure the tier of your Azure SQL database according to our .recommendations
Deploying existing Kentico projects to Azure Web AppsIf you already have a Kentico website or web application project hosted on a traditional web server or prepared for deployment, you candecide to move your project to the Azure Web Apps service (renamed from Azure Websites, ).see details
This scenario expects that you have a Kentico website or web application project installed in a local file system, connected to a standardMicrosoft SQL database. If you want to move your project to Azure Web Apps, you need to:
Deploy your database to Azure SQL (if you want to have the whole project on Azure, otherwise it is not necessary)Create a new Azure Websites service.Deploy the project files through Visual Studio. Alternatively, you can also .deploy your project over FTP
However, please read the section first and adjust your project according to the recommendations.Possible issues
Possible issues
The following issues present problems which you should be aware of during the process of deploying an existing project to an Azure WebApps project. Please asses whether they apply to your project and adjust your project according to the recommendations.
1. 2. 3. 4.
5. 6. 7.
1. 2. 3. 4. 5. 6.
If you have set up a in your project, the system may contain unnecessary web farm servers in the database. Therefore,web farmwe recommend that you delete the old web farm servers in the UI to ensure that a licensing error does not occur. And configure theweb farms to generate web farm servers automatically.If you are deploying a project and you (form layouts, page layouts, transformations, etc.) inweb application store virtual objectsthe file system (when the option is enabled), the virtualSystem -> Virtual objects -> Store all virtual objects in file systemobjects may not be deployed together with the project. Either move the objects back to the database or include the object files in theproject (as described in ) before deploying your project to the Azure platform. KenticoDeployment mode on web application projectswebsite projects do not require any actions in this regard.Your may contain custom database objects that are not supported on Azure SQL. Because of this limitation of the Azuredatabaseplatform, you might not be able to migrate your database to Azure SQL without modifications. You might encounter issues whendeploying your database to Azure if you have somehow customized your database (stored procedures, indexes, access to tables) orif 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 thatyou move your database to Azure as well, as hosting your database on Azure ensures the best performance for your project. In this case,you can deploy the database directly from Microsoft SQL Management Studio:
Create an Azure SQL Server and configure its firewall to accept your IP address.Open and expand the node.Microsoft SQL Management Studio DatabasesRight-click your database and select .Tasks -> Deploy Database to Windows Azure SQL DatabaseOn the tab of the deployment dialog-box, click to connect to the created Azure SQL server (theDeployment Settings Connect...server name has the following form: ).<servername>.database.windows.netType the name of a database into which the local database will be deployed.newClick and .Next FinishChange the connection string in the file of your project to connect to the deployed Azure SQL database. You can useweb.configthe following template:
<connectionStrings> <add name="CMSConnectionString"connectionString="Server=DATABASE_SERVER.database.windows.net;Database=DATABASE_NAME;UserID=DB_SERVER_USER_NAME;Password=DB_SERVER_PASSWORD;Trusted_Connection=False;Encrypt=True;Connection Timeout=120" /></connectionStrings>
Replace the upper-case words with your own data.
You have deployed your database to the Azure SQL database. Proceed to .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 or directly from Visual Studio:management portal
Open your Kentico project in Visual Studio.Open the tab (or Database Explorer tab in Express editions of Visual Studio).Server ExplorerRight-click and select and sign in to your Azure account.Azure Connect to Microsoft Azure SubscriptionExpand the node.AzureRight-click and select .Web Sites Create New SiteType the name of the web app, select your subscription, region for the web app (choose the same region as the SQL server), thecreated database server and fill in the server credentials.
Microsoft SQL Server version
This procedure works only with or newer. If you have an older version, upgrade your SQL serverMicrosoft SQL Server 2012 SP1(you can also use the free Express edition) or use an external tool for migrating the database, for example SQL Azure Migration
.Wizard
In Microsoft Visual Studio 2012 and 2013, the service is still called Azure Websites.
6.
7.
8. 9.
Click .CreateThe system creates a new Azure Web App.
Right-click the newly created web app and select .View settingsModify the connection string to connect to your database deployed to an Azure SQL server (change the name of the database tocorrespond to the deployed database).
You can view the newly created web app in the under Web Apps. The Web App service is now empty. You canAzure management portalnow deploy your project to Azure Web Apps.
Part 3 - Deploying projects to Azure Web Apps
The process for deploying a Kentico project is similar for Kentico website and web application projects. The difference is that with web projects, you need to subsequently deploy all the project folders (CMSApp and CMSApp_AppCode) to the Web App service.application
1. 2. 3.
4. 5.
Automatically created Azure SQL Database
Note that creating a Web App from Visual Studio also creates a new Azure SQL Database on the specified server. If you havedeployed your local database to Azure, you will not need this newly created database. Therefore, you should delete the newlycreated database to avoid additional costs:
Open the .Azure management portalSelect .SQL DatabasesSelect Select the automatically created database. The name should correspond to the name of the newly created WebApp.Switch to the tab.DashboardClick in the bottom panel.Delete
Including files in web application projects
1. 2.
3.
4. 5. 6. 7. 8. 9.
Open your Kentico project in Visual Studio.Open the web.config file and make sure that the mode is set to .sessionState InProc
<sessionState mode="InProc" />
Use mode if you plan to use one instance of the Web App service. If you want to scale your web app to more instances, youInProcwill need to configure the session state differently. See .Storing cache and session state data in Azure environment
Right-click the project folder ( or ) in the Solution Explorer and select (or ).CMSApp CMS Publish Publish Web Site
Select .Microsoft Azure Web SitesSelect the previously created web app in the drop-down list.Click . The system downloads the publish profile.OKLeave the settings as they are.Click .PublishIn case of Kentico projects (CMSApp folder), publish also the folder.web application CMSApp_AppCode
After publishing the first project folder, make sure that your publish profile has the Delete all existing files prior to publish/ option . You can configure the option in the dialog in Remove additional files at destination disabled Publish Web Setti
.ngs -> File Publish Options
The system deploys your project to the Azure Web App service. Check that the project is correctly connected to the database (the databaseinstallation 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
on your web appAdjust the web hosting plan mode .Configure the tier of your Azure SQL database according to our .recommendations
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 storagespace is limited – the Basic plan has 10 GB storage available, see for details. When you exceed the capacity, for example byWebsites Limitsuploading large media files, you have the following options:
Rise the web hosting plan to Standard, which has 50 GB of storage. Configure your system to use Azure Blob Storage and store the media files there.
See for instructions.Increasing storage capacity on Azure Web Apps
Configuring web farms for Azure Web Apps
If you plan to increase the number of instances associated with your Web App service (on the tab), you need to configure web farms inScaleyour project to dynamically create and delete web farm servers. See for instructions. Enabling web farms on Windows Azure Web Apps
If you are deploying a project, do not forget to include added files to the project. For example media library filesweb applicationadded through the user interface.
To add files to a project, locate the file in the Solution Explorer, right-click the file and select . This ensures thatInclude in projectthe files are deployed along with the project.
1. 2. 3.
1. 2. 3.
4.
5. 6. 7.
1. 2. 3. 4. 5. 6.
7.
8. 9.
Migration of Kentico projects from Azure Cloud Services to Azure Web AppsThis scenario expects that you have a Kentico Azure project running in Azure Cloud Services, connected to the Azure SQL server and AzureBlob Storage and you have access to the local development project. When you decide to migrate your project from Azure Cloud Services toAzure Web Apps (renamed from Azure Websites, ), you need to create a new Web App service and transfer your configurations tosee detailsthe web.config file of your project. You can utilize the existing Azure SQL Database and Azure Blob Storage without changes.
To migrate an Azure project from Cloud Services to Web Apps, you need to:
Transfer configurations from the ServiceConfiguration.Cloud.cscfg file to the web.config file.Create a new Azure Web App service.Deploy the project as a web application through Visual Studio. Alternatively, you can also .deploy your project over FTP
Part 1 - Configuring Azure projects for Azure Web Apps
You can deploy only Kentico website and web application projects to Azure Web Apps. Kentico projects installed as Azure projects contain astandard web application project in them. Therefore, you need to transfer configuration settings from the ServiceConfiguration.Cloud.cscfgfile to the file in the web application project and then deploy the web application project to Azure Web Apps.web.config
Open your Azure project in Visual Studio using the file.WebApp.slnOpen the file.CMSApp\Web.configAdd the key and value to the section of the web.config file.CMSConnectionString connectionStrings
<connectionStrings> <add name="CMSConnectionString" connectionString="DataSource=tcp:YourServerName.database.windows.net,1433;InitialCatalog=YourDatabaseName;UserId=YourUsername@YourServerName;Password=YourPassword;" /></connectionStrings>
Add the CMSAzureAccountName and CMSAzureSharedKey keys to the section of the web.config file.appSettings
<appSettings> ... <add key="CMSExternalStorageName" value="azure" /> <add key="CMSAzureAccountName" value="YourStorageAccountName" /> <add key="CMSAzureSharedKey" value="YourPrimaryAccessKey" /></appSettings>
Replace and with values from the ServiceConfiguration.Cloud.cscfg file.StorageAccountName PrimaryAccessKey
Right-click the project in the Solution Explorer and select .CMSApp Set as StartUp ProjectRight-click the folder and select .CMSApp_AppCode\Old_App_Code\CMSModules\WindowsAzure Exclude From ProjectAlso transfer any custom settings from the ServiceConfiguration.Cloud.cscfg file to the web.config file.
Your project is now ready to be deployed to Azure Web Apps, but first you need to create a new Azure Web App service.
Part 2 - Creating Azure Web Apps from Visual Studio
Before you can deploy your project, you need to create a new Azure Web App service. You can do this from the Microsoft Azure or directly from Visual Studio:management portal
Open your Kentico project in Visual Studio via the file.WebApp.slnOpen the tab (or Database Explorer tab in Express editions of Visual Studio).Server ExplorerRight-click and select and sign in to your Azure account.Azure Connect to Microsoft Azure SubscriptionExpand the node.AzureRight-click and select .Web Sites Create New SiteType the name of the web app, select your subscription, region for the web app (choose the same region as the SQL server), thecreated database server and fill in the server credentials.Click .Create
The system creates a new Azure Web App. Right-click the newly created web app and select .View settingsModify the connection string to connect to your database deployed to an Azure SQL server (change the name of the database tocorrespond to your Azure SQL database).
In Microsoft Visual Studio 2012 and 2013, the service is still called Azure Websites.
1. 2.
3. 4. 5. 6. 7. 8. 9.
1. 2. 3. 4. 5.
You can view the newly created Azure Web App in the under Web Apps. The Web App service is now empty. YouAzure management portalcan now deploy your web application project to Azure Web Apps.
Part 3 - Deploying Azure projects to Azure Web Apps
You are deploying your Azure project as a Kentico web application project. With web application projects, you need to subsequently deployall the project folders (CMSApp and CMSApp_AppCode) to the Web App service.
Open your Kentico project in Visual Studio via the file.WebApp.slnOpen the web.config file and make sure that the mode is set to .sessionState InProc
<sessionState mode="InProc" />
Use mode if you plan to use one instance of the Web App service. If you want to scale your web app to more instances, youInProcwill need to configure the session state differently. See .Storing cache and session state data in Azure environment
Right-click the project folder ( or ) in the Solution Explorer and select (or ).CMSApp CMS Publish Publish Web SiteSelect .Microsoft Azure Web SitesSelect the previously created web app in the drop-down list.Click . The system downloads the publish profile.OKLeave the settings as they are.Click .PublishPublish also the folder.CMSApp_AppCode
After publishing the first project folder, make sure that your publish profile has the Delete all existing files prior to publish/ option . You can configure the option in the dialog in Remove additional files at destination disabled Publish Web Setti
.ngs -> File Publish Options
The system deploys your project to the Azure Web App service. Check that the project is correctly connected to the database (the databaseinstallation dialog does not appear).
Proceed to performing the following final configurations:
Adjust the web hosting plan mode for your Web App service.Check that your Azure SQL database adheres to our .recommendationsIncreasing storage capacity on Azure Web Apps
After that, your Kentico project is ready to run in Azure Web Apps.
Configuring web farms for Azure Web Apps
If you plan to increase the number of instances associated with your Web App service (on the tab), you need to configure web farms inScaleyour project to dynamically create and delete web farm servers. See for instructions.Enabling web farms on Windows Azure Web Apps
Web farms are configured in Cloud Services environment automatically, however, you need to enable them manually in Web Apps.
Adjusting the web hosting plan mode on Azure Web AppsWhen you create an Azure Web App service in Visual Studio or the Azure Management Portal, the service runs in the Web hosting planFreemode. This mode is not sufficient for running a Kentico application. Therefore, you should select a higher plan:
Open the .Azure management portalSelect and select your created web app.Web AppsSwitch to the tab.ScaleSelect at least the Web hosting plan mode. Free and Shared hosting plans do not provide enough memory to run Kentico.BasicClick in the bottom panel.Save
All web apps created in the same geographic region will have the same hosting plan mode.
Increasing storage capacity on Azure Web Apps
1. 2. 3. 4. 5.
Automatically created Azure SQL Database
Note that creating a Web App from Visual Studio also creates a new Azure SQL Database on the specified server. If you alreadyhave a database on Azure, you will not need this automatically created database. Therefore, you should delete this database toavoid additional costs:
Open the .Azure management portalSelect .SQL DatabasesSelect the automatically created database. The name should correspond to the name of the newly created Web App.Switch to the tab.DashboardClick in the bottom panel.Delete
1. 2.
1. 2. 3.
4.
5.
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 storagespace is limited – the Basic plan has 10 GB storage available, see for details. When you exceed the capacity, for example byWebsites Limitsuploading large media files, you have the following options:
Rise the web hosting plan to Standard, which has 50 GB of storage. Configure your system to use Azure Blob Storage and store the media files there.
Configuring Azure Web Apps to use Azure Blob Storage
If you want to connect your Web App service to the Azure Blob Storage and store files there, you have two possibilities depending on theamount of files you want to store there:
Store only specific media libraries on Azure Blob Storage .(recommended)When you run out of space, you can simply map certain media libraries to the Blob storage without needing to changeanything else.
Store all files on Azure Blob Storage. This includes for example media files, Smart search indexes and web analytics log files. With this approach, you will need toenable processing of Smart search tasks using a scheduled task and you will have to remap web analytics log storagefolder.Choose this option only if you are sure you need to have your project configured this way. For example if you need to haveall media files stored in one place.
Storing only specific media libraries on Azure Blob Storage
Proceed according to .Configuring Kentico to store only media files on Azure storageRe-deploy your project to the Azure Web Apps.
Notes:
Links to the media files will be different for files in the file system and files located on the Blob Storage.Everything else apart from the media library files will be stored on the Web App server file system.
Storing all files on Azure Blob Storage
Open the , select and create a new Azure Blob Storage.Azure management portal StorageAdd keys to the web.config file according to .Configuring Kentico to map its file system to Azure storageAdd the following key to the section of your web.config file:appSettings
<add key="CMSProcessSearchTasksByScheduler" value="true" />
Make sure that the scheduled task is enabled and set to a reasonable value (for example one hour). Execute search tasksThis scheduled task and the web.config key ensure that the system processes search tasks on a shared storage (Blobstorage).
Re-deploy your project to the Azure Web Apps.
From now on, the system will use the Azure Blob Storage to store new media files, Smart search indexes and web analytics logs.
Notes:
Already are stored in the file system. No action is needed, however, if you wish, you can move them toexisting media library filesthe Blob Storage as well. This would require re-saving of the links to the media library files from content ( application).PagesBy default, are also stored on the Blob Storage. The Web analytics module writes and processes logs everyweb analytics logsminute, which can cause problems on the Blob Storage with latencies. We highly recommend that you map the folder which storesWeb analytics data to the file system of the Web App server. See Mapping the Web analytics storage folder to the server file systemfor instructions.
Enabling web farms on Azure Web AppsMicrosoft Azure Web Apps (renamed from Azure Websites, ) allow you to scale the computing power allocated for your web appsee detailson Microsoft Azure. This feature allows you to increase performance and throughput for your web app. See articleHow to scale Web Appsfor details.
For this functionality to work in Kentico, you need to enable and configure the in your Kentico website. Web farm module
Azure CDN
You can enable only for files stored on the Azure Blob Storage.Azure CDN
1. a. b. c. d.
2. 3. 4.
5.
After you create an Azure Web App service with a Kentico application and deploy it using Visual studio (see Setting up Kentico in Azure Web), enable and configure web farms in the Kentico system:Apps
If you have already scaled your web app to 2 or more instances, scale it back down to 1 instance:Open and select your web app.Windows Azure Management PortalSwitch to the tab.ScaleSet the to 1.Instances countClick in the bottom panel.Save
Open the Kentico administration interface of your web app.Open the application and open the category.Settings Versioning & Synchronization -> Web farmSelect as the .Automatic Web farm mode
This setting allows the system to generate and delete web farm servers dynamically according to the allocated computinginstances.See for more information.Setting up web farms
Configure where the session state data will be stored.
The system is now prepared for increasing and decreasing computing instances (you can scale your application through the portal on the Sc tab) and will generate web farm servers and synchronization tasks automatically.ale
Azure Web Apps problematic foldersIf the following conditions are met, we recommend deleting files from the file system in the folders listed below:
You are developing Azure Web Apps with a blob storage ANDyou are deploying Web Apps projects through FTP (or some other way than through Visual Studio) ORif you are developing Web Apps as a website project.
In these situations, the files in these folders are included in the file system of the Web Apps service. This could cause problems when using ablob storage.
Azure Cloud Services are not affected by this, as the deployment is done exclusively through the Visual Studio which ensures that these filesare not included.
Delete files in the following folders before the deployment of your Web Apps:
~\CMS\CMSApp\App_Data\Persistent\~\CMS\CMSApp\App_Data\CMSModules\SmartSearch\ - without and folders, which should stay in the_StopWords _Synonymsfile system.~\CMS\CMSApp\App_Data\CMSModules\WebAnalytics\ - without folder, which should stay in the file system.MaxMind~\CMS\CMSApp\App_Data\CMSTemp\~\CMS\CMSApp\App_Data\CIRepository\~\CMS\CMSApp\App_Data\AzureTemp\ (might differ based on the configuration of the blob storage temp path)~\CMS\CMSApp\App_Data\AzureCache\ (might differ based on the configuration of the blob storage cache path)
Running Kentico in Azure Cloud ServicesMicrosoft Azure Cloud Services is a highly scalable cloud hosting platform.
Compared to Azure Web Apps, the Cloud Services provide more control, but are slightly less easy to use and manage. This section providesinformation on how to configure and run Kentico in Azure Cloud Services.
Basic information about running Kentico in Microsoft Azure Cloud Services
Installation and deployment to Azure Cloud Services
We support this functionality only for and .Basic Standard web hosting plans
Azure Web Apps
This section is about Azure Cloud Services. If you are interested in the alternative hosting option, , see Azure Web Apps Running section. Or first see the page.Kentico in Azure Web Apps Microsoft Azure web hosting options
Architecture of Microsoft Azure Cloud ServicesRequirements and limitations for running Kentico in Azure Cloud ServicesLifecycle for developing Kentico projects in Azure Cloud Services
Additional information
Architecture of Microsoft Azure Cloud ServicesThis topic describes how Kentico works within the Microsoft Azure environment using , which features of the serviceAzure Cloud Servicesare utilized and how the application stores and manages its data in the cloud.
Application
If you choose to , all files will be grouped into a solution based on Visual Studio's Microsoft Azure template.install Kentico as an Azure projectThe solution contains several projects. One of them is a web application, which encompasses almost all the functions of Kentico and isdesigned to run as an Azure . ASP.NET Web role
The worker, is separated from the web application in another project because it cannot run together with the application as theSmart search Web role. To index content of websites correctly and effectively, the Smart search worker runs as an Azure .Worker role
Because the application is divided into these two services, you also need to configure them separately. See Configuring Kentico Azure
1. 2. 3. 4. 5.
To install and deploy a new Kentico Azure project to Azure Cloud Services:
Prepare the cloud environmentInstall Kentico as an Azure projectConfigure the Azure projectDeploy the project to Cloud ServicesInstall the database for your project
Developing Kentico Azure projects locally - learn how to set up Azure projects to prepare them for the development on yourlocal machines.Developing for Microsoft Azure Cloud Services - best practices - our recommendations on how to configure Azure projects andyour environment.Configuring Azure storage - in case you do not need to host your whole application in the cloud, you can utilize this hybridscenario, which uses Microsoft Azure Storage as a file storage for your project.Azure web.config settings - see this reference for a list of available web.config setting keys for your Azure project.
projects for Cloud Services.
Database
Kentico on Microsoft Azure uses an relational database. This database engine is almost identical to the standard SQL Server Azure SQL engine, with only a few limitations. These limitations are taken into account in Kentico, and no additional configuration or customization isrequired. If you're interested in which SQL Server features are not available in Azure SQL, refer to Azure SQL Database Transact-SQL
on MSDN. Also see our to prevent performance problems.Reference Recommendations on using Azure SQL Database tiers
File storage
Microsoft Azure does not offer a persistent file system similar to the file systems in Windows that you are used to. Data stored within Azurecannot be hierarchically organized into folders. However, Kentico provides an abstract layer called , which enables the system toCMS.IOoperate on different types of file storages. See for more information.Working with physical files using the API
The CMS.IO namespace acts as an intermediary between the Kentico business layer and various file storages, including Azure blob storage. On a standard non-Azure installation, CMS.IO only overrides the System.IO namespace. On Microsoft Azure, the namespace uses aprovider which works with the blob storage, creating an imitation of the regular Windows file system. The CMS.IO namespace can be extended to support any other type of storage, e.g. the Amazon cloud drive.
Additionally, you can make use of the Azure storage provider and store files in the cloud even if you're running a non-Azure installation. Youcan find more information about this approach in Configuring Azure storage.
The file storage is shared across multiple web role instances, therefore, no file synchronization is needed.
Multiple web role instances
Kentico application can run in multiple instances of one web role on Microsoft Azure. Therefore, the data must be synchronized betweenthese instances. Kentico handles the synchronization by considering each instance a web farm server. When you set the number of
, the web farm servers are configured automatically. Also, web farm tasks are created and executed automatically so no manualinstancesconfiguration is needed.
When you need to optimize cache performance, you can create a Cache service on the Azure Management Portal and configure it tosynchronize cache. See Storing session state information in Azure Cache Service for details.
Storing session state
Every complex web application needs to store information about its state, especially user session data. Since the Azure environment isdynamic and the application does not reside constantly in one place, its state has to be stored separately. When your application uses onlyone web role instance, the session state data can be stored on that instance. If your application uses two or more web role instances, youneed to configure your project to store the session state data elsewhere. We recommend these options for storing the session state data:
In Microsoft Azure SQL Database - easy to set up, suitable for small projects or projects with mostly read access to web pages.In Microsoft Azure Cache - more suitable for larger projects than the Azure SQL database option, but requires configuration of AzureCache.
See for more information.Storing cache and session state data in Azure environment
Microsoft Azure Web Apps or Virtual Machines
This section describes the setup and deployment of Kentico to an . However, there are other Azure environments, inAzure Cloud Servicewhich Kentico is supported as well.
Web Apps are quick to deploy and easy to set up and manage. However, they do not offer as much customization options as cloudservices. See for information on how to set up Web Apps.Setting up Kentico in Azure Web AppsVirtual Machines allow you to configure and maintain a virtual server in the cloud. They offer more control but require complex setup.You can start using the Virtual Machines by creating one in the .Azure Management PortalFor a more detailed comparison of all three services provided by Microsoft Azure, see Azure Web Sites, Cloud Services and Virtual
on MSDN.Machines comparison
Requirements and limitations for running Kentico in Azure Cloud ServicesIf you wish to run Kentico in the Microsoft Azure Cloud Services environment, make sure that you are familiar with the followingrequirements.
Case sensitivity
Unlike Windows file systems, the blob storage is case-sensitive. As a result, names of all files processed by Kentico are converted before saving.to lower case
Development tools
Install the following software on the machines where you plan to develop your Azure project:
Microsoft Visual Studio 2012/2013/2015 (including Microsoft Visual Studio 2012/2013/2015 Express Edition).Microsoft .NET Framework 4.5/4.5.1 (it will be installed automatically on your computer during the ).installationAzure SDK 2.7.1 including Microsoft Azure Tools for the version of Microsoft Visual Studio you are using.Microsoft Internet Information Services (IIS) 7.0 or newer - required if you wish to run the application locally on the Microsoft AzureCompute Emulator.
You can download the Azure SDKs with Tools for Visual Studio from .http://azure.microsoft.com/en-us/downloads/archive-net-downloads/
Microsoft Azure requirements
The exact hosting requirements depend on the resource consumption and traffic load of your site and its components. You need to preparethe following services for your Azure subscription:
Azure cloud service - for production (live) deployments of Kentico websites, it is highly recommended to use at least the Small Co.mpute Instance Size
Azure storage accountAzure SQL server and database - required if you wish to host your application database on Microsoft Azure. The smallest availabledatabase (1GB) is sufficient for the default Kentico installation.
Kentico licensing
You need a Website license (CMS or EMS) with web farm server licenses for the number of Microsoft Azure instances you are using. Thenumber of required web farm licenses depends on the number of instances, not the number of actual physical servers involved. Werecommend that you use two instances to qualify for Microsoft Cloud service .SLA
For licensing information, refer to and .Cloud licensing Price list
Limitations
If the application database is hosted on (formerly known as SQL Azure), it is important to keep in mind that certainAzure SQL Databasestatements and expressions are restricted when writing queries (e.g., in custom code, web part properties or for reporting objects). For acomprehensive list of all SQL Database features and requirements, see on MSDN.Azure SQL Database Guidelines and Limitations
A shortcoming of any application running on Microsoft Azure is the need to redeploy (or at least update your deployment) before anychanges made to the project structure or code are reflected. This may make it more difficult and time consuming to perform websitemaintenance, customization and some development tasks. However, you can use the functionality for development and testingWeb deploypurposes.
In addition, the following features of Kentico are currently limited:
Full site import - importing sites is possible, but files stored in the web project, such as custom user controls, ASPX page templatesor design files, will not be included in the import process. To work around this limitation, you can copy such files into the target Azureproject and include them in the solution before you deploy the application to Microsoft Azure.CSS Theme tabs - management of files contained in stylesheet Theme folders directly through the Kentico administration interfaceis not available when running on Microsoft Azure.JavaScript does not work on Microsoft Azure.minification
Lifecycle for developing Kentico projects in Azure Cloud ServicesWhen you develop projects in Microsoft Azure Cloud Services, in typical cases you want to begin with a small size of the project, which usesthe least resources possible. Then, as your project grows, you configure your project to utilize more resources to accommodate theperformance and size requirements of the project. This topic presents main on Microsoft Azure and provides links tolevels of developmentrelated configuration tasks, which you need to perform when ascending to a higher level.
Level 0 - Local development
You can choose to begin developing your Kentico Azure project locally in an emulator before deploying it to the cloud environment. In thiscase, set up a database and Azure Storage service and configure the web role's settings. See .Developing Kentico Azure projects locally
Level 1 - Development
For the duration of project development, of CMSApp web role is usually enough. To configure a project to use one web roleone instanceinstance, perform the tasks.basic configuration
1. 2. 3. 4. 5.
Level 2 - Production with SLA
When you deploy your project and switch to the production environment, you may want to qualify for . In such case, yourMicrosoft SLAproject must use at least of the CMSApp web role. When you increase the number of used web role instances, you need totwo instancesadjust your project to synchronize the data between the instances and to store session state information.
For data synchronization, you can use the default tasks, in which case you do not need to configure anything.web farm synchronization
For storing session state information, you can use – see Microsoft Azure SQL Database Storing session state information in Azure SQL.Database
Level 3 - Performance
When the performance of the level 2 environment is not sufficient, you can configure the to store session stateAzure Cache Serviceinformation – see .Storing session state information in Azure Cache Service
Level 4 - Scalability
When you need even more power, you can further scale your project using the following approaches:
Utilize larger cloud servicesUse more web role instancesConfigure autoscaling
Preparing the Azure cloud environmentBefore you start installing a Kentico project for Microsoft Azure, it can be convenient to configure the cloud environment using the Microsoft
and create parts of the system you will need. It is not necessary to create all the parts in advance, but doing so allAzure Management Portalat once can save you time later.
To run a Kentico project on Microsoft Azure, you will need to create:
Azure StorageAzure Cloud Service
An Azure project can use a standard hosted SQL Server or a cloud server. If you want to use the database service on Microsoft Azureeitherplatform, create also:
Azure SQL ServerAzure SQL Database
Service location and affinity groups
We recommend that you configure an and use it for all data and cloud services you create. An affinity group ensures that theaffinity groupservices assigned to it will be located in one datacenter and even close together within the particular datacenter.
To create an affinity group:
Click in the left toolbar.SettingsSelect the tab.Affinity groupsClick .AddType the and for the affinity group.Name DescriptionSelect the ideal .Region
5.
6.
1. 2. 3.
Finish the creation.
When creating new services, you can now assign them to the same affinity group to ensure their best performance.
Creating a Microsoft Azure Storage
The Microsoft Azure Storage account will serve as a file system for your cloud based project. It provides access to the blob, queue and tableservices.
Click .New -> Data services -> Storage -> Quick createType a URL (name) of your new Azure storage, which is not currently in use.Select the location for your storage. Use an affinity group or the same location for all created services.
Alternatively, you can also select the (for example, East US) for all created services.same location
3.
4.
1. 2. 3.
4.
1. 2. 3. 4.
5.
Click .Create storage account
The portal creates the storage and you can see it in the list of storages.
Creating a Microsoft Azure Cloud service
The Microsoft Azure Cloud Service provides an infrastructure for the code and configuration of your project.
Click .New -> Compute -> Cloud service -> Quick createType a URL (name) of your new Azure cloud service, which is not currently in use.Select the location for your storage. Use an affinity group or the same location for all created services.
Click .Create cloud service
The portal creates the cloud service.
Creating a Microsoft Azure SQL Server
The Azure SQL Server is a virtual server you can create in the cloud. You will need the server to create databases in it.
Select in the panel on the left.SQL DatabasesClick .ServersClick .AddSpecify a login name and password for the server.
5. 6.
7.
1. 2. 3.
4.
1. 2. 3.
Choose a region for the server's location. Use an affinity group or the same location for all created services..Ensure, that the option is selected.Allow Windows Azure services to access the server
This option adds special firewall rules to allow your deployed Kentico project to access the server and its databases.
Confirm the creation of the server.
The portal creates a new server. If you want to manage this server locally or use a local emulator, add firewall rules for IP ranges of yourdevelopment and administration machines:
Adding firewall rules for a server
Select the server.Switch to the tab.ConfigureClick the link or type the name of the rule and the IP address range of your development andAdd to the allowed IP addressesadministration machines.Click in the bottom panel.Save
You have configured the server to be locally accessible.
Creating a Microsoft Azure SQL Database
Create a new database on the virtual server, so that you can use it for Kentico database installation:
Click .New -> Data services -> SQL database -> Quick createType the name of the database.Choose the Azure SQL database server you have already created.
3.
4.
1. 2. 3. 4. 5.
6.
Click .Create SQL database
The portal creates your SQL database and you can later use it to in it. Also see our install the Kentico database Recommendations on using to prevent issues with database performance.Azure SQL Database tiers
Now proceed to .Installing Kentico Azure projects
Installing Kentico Azure projectsIf you want to deploy Kentico to Microsoft Azure Cloud Services, you must first install Kentico on your local computer as an Azure project:
Run the Kentico Installer on your development computer.localCheck the license agreement and select the option.Custom installationSwitch to the tab.Installation typeSelect the .Built-in web server in Visual StudioChoose a folder for the project files (for example, C:\Temp\KenticoAzure).
The files will be only copied to this location.Select as the Web project type.Microsoft Azure project
6.
7. Click .Install
The Installer copies the project files into the specified folder. When the installation is finished, click the displayed link to open the web projectin Visual Studio.
Proceed with .Configuring Kentico Azure projects for Cloud Services
1. 2. 3. 4.
1. 2. 3. 4. 5. 6.
Configuring Kentico Azure projects for Cloud ServicesAfter you and , you need to configure your project before the actual deploymentinstall a Kentico Azure project prepare the cloud environmentto the Azure Cloud Services.
Basic configuration - perform these configuration tasks for every Kentico Azure project.Advanced configuration - perform these configurations when you upgrade your project to use two or more web role instances.Additional configurations - you can perform these configurations in any phase of your project.
Adding application settings in an Azure project
Generally, you can add settings for your Azure application either in the or in the file.web.config file ServiceConfiguration.Cloud.cscfg
However, when you need to modify setting values in the web.config file, you have to deploy the whole project again. When you need tomodify setting values configured in the ServiceConfiguration.Cloud.cscfg file, you can modify them on the in Azure Management Portal Clou
tab. Therefore, we recommend that you configure your application mainly using thed services -> ConfigureServiceConfiguration.Cloud.cscfg file.
To add new settings to the configuration file:
Open your Azure project in Visual Studio.Double-click role in .CMSApp CMSAzure/RolesSwitch to the tab.SettingsClick .Add Setting
When you add or remove settings this way, Visual Studio ensures that all necessary files (ServiceConfiguration.Cloud.cscfg,ServiceConfiguration.Local.cscfg and ServiceDefinition.csdef) are modified according to your changes.
Basic configuration
These configuration tasks are necessary to perform for every Microsoft Azure project.
Setting the Azure blob storage access keys
Open your Azure project in Visual Studio.Open the file.ServiceConfiguration.Cloud.cscfgAccess the in a browser and log in.Azure Management PortalClick .StorageSelect your storage.Click on the bottom panel. Manage access keys
Azure SDK version
Before you start configuring your Kentico Azure project, check that you have installed for your version ofAzure SDK version 2.7.1Visual Studio.
Whenever you add or remove settings, you have to deploy your project to the cloud. Therefore, you should decide in advancewhich functionality you need to configure in your Azure project.
6.
7.
8.
Copy the and enter it as a value of setting in role section in theStorage account name CMSAzureAccountName CMSAppServiceConfiguration.Cloud.cscfg file.Copy the and enter it as a value of setting in role section in thePrimary access key CMSAzureSharedKey CMSAppServiceConfiguration.Cloud.cscfg file.
<Role name="CMSApp"> <ConfigurationSettings> <Setting name="CMSAzureAccountName" value="YourStorageName"/> <Setting name="CMSAzureSharedKey" value="YourPrimaryAccessKey"/> </ConfigurationSettings></Role>
8.
9.
1. 2. 3.
4.
1. 2. 3. 4.
5.
1.
Replace and with your own values.YourStorageName YourPrimaryAccessKey.Save the configuration file.
You have connected your Azure project with the Azure blob storage.
Configuring smart search
Before you deploy your Azure project to the cloud, you must decide whether you want to utilize the smart search functionality or not. Youhave the following options:
Configure the SmartSearchWorker role (recommended)Remove the SmartSearchWorker role and configure processing of smart search tasks in the CMSApp roleRemove the SmartSearchWorker role and disable smart search functionality
Configuring the SmartSearchWorker role
If you want to use the SmartSearchWorker role and utilize the smart search functionality, configure the and Storage account name Primary for this role.access key
Open your Azure project in Visual Studio.Open the file.ServiceConfiguration.Cloud.cscfgCopy the and keys (which you set when ) withCMSAzureAccountName CMSAzureSharedKey configuring the storage access keystheir values from the CMSApp role section to the role section:SmartSearchWorker
<Role name="SmartSearchWorker"> <ConfigurationSettings> <Setting name="CMSAzureAccountName" value="YourStorageName"/> <Setting name="CMSAzureSharedKey" value="YourPrimaryAccessKey"/> </ConfigurationSettings></Role>
Replace and with your own values.YourStorageName YourPrimaryAccessKey.Save the configuration file.
You have configured the SmartSearchWorker role to work on Microsoft Azure. If you do not need to perform any other configuration tasks,continue to .Deploying Azure projects to Cloud Services
Configuring the processing of smart search tasks in CMSApp web role
If you would not utilize the whole worker role, but you do not want to lose the smart search functionality entirely, you can set that the searchtasks will be processed by the main CMSApp web role. This solution can be used by small projects only, as the smart search tasks affect theperformance of the web role.
Open your Azure project in Visual Studio.Remove the role from CMSAzure/Roles.SmartSearchWorkerOpen the file from the CMSApp project.web.configAdd the key to the <appSettings> section:CMSProcessSearchTasksByScheduler
<add key="CMSProcessSearchTasksByScheduler" value="true" />
Save the web.config file.
The smart search tasks will now be processed by the CMSApp web role. The SmartSearchWorker role will not be deployed to the hostingenvironment, so the costs of running your application on Microsoft Azure will be lower. If you do not need to perform any other configurationtasks, continue to .Deploying Azure projects to Cloud Services
Disabling smart search functionality
If you are certain that you will not need the Smart search module in your project:
Setting the keys after the deployment
If you do not set the storage access keys before you deploy the Azure project to the cloud, you can do it after the deployment aswell in the . Navigate to select your service , where you can copy the Azure Management Portal Cloud services -> -> Configure St
and as values of the and settingsorage account name Primary access key CMSAzureAccountName CMSAzureSharedKeyfor the roles.
1. 2.
1. 2. 3.
4.
1. 2.
3.
Open your in Visual Studio.Azure projectRemove the role from CMSAzure/Roles.SmartSearchWorker
Disabling the smart search completely reduces the number of roles that need to be hosted, so the costs of running your application onMicrosoft Azure will be lower. If you do not need to perform any other configuration tasks, continue to Deploying Azure projects to Cloud
.Services
Advanced configuration (more web roles)
When you use more than one instance of the CMSApp web role, the system considers these instances as web farm servers. Therefore, youneed to configure your project according to the instructions in this section.
Configuring the number of instances
You can set up the number of instances used for the role, which represents the Kentico application. This determines the number ofCMSAppvirtual machines dedicated to the website. The number of instances influences the performance and load handling capacity of theapplication.
To set the number of instances used for the CMSApp role, change the value of the attribute of the role's element:count <Instances>
Open your Azure project in Visual Studio.Open the file.ServiceConfiguration.Cloud.cscfgChange the setting to the required number of instances:<Instances count="1" />
<Role name="CMSApp"> <Instances count="2" /> <ConfigurationSettings> ... </ConfigurationSettings></Role>
Save the configuration file.
Each instance is represented by a separate web farm server within the Kentico system. The creation and management of the servers ishandled automatically, and you do not have to perform any further configuration.
Instance licensing
The Kentico license used for your domain must allow at least as many web farm servers as the amount of instances set for the role. See http: for pricing information.//www.kentico.com
Configuring cache and session state data
If you want your Azure application to use two or more web role instances, choose where to store session state information. See Storing for details.cache and session state data in Azure environment
Additional configurations
You can perform the configurations in this section in any phase of project development.
Configuring sizes of the CMSApp web role
The size of a web role determines the number of CPU cores, the memory capacity, and the local file system size that is allocated to a runninginstance. You can change the size of the web role anytime, however, note that is required after the change.full redeployment
Open your Azure project in Visual Studio.Open the file.ServiceDefinition.csdef
You can also change the number of used instances on the in tab.Azure Management Portal Cloud services -> Scale
SmartSearchWorker role
Do NOT increase the number of instances for the role. Due to the way smart search indexes are processed,SmartSearchWorkerthe required tasks must be performed by a single instance.
3.
1. 2.
3. 4.
Set the attribute of the element to the size that you desire.vmsize WebRoleFor more information about the available size options, see .Virtual Machine and Cloud Service Sizes for Azure
<WebRole name="CMSApp" vmsize="Large">
Configuring external Windows services
By default, external Windows services ( and ) that come with Kentico do not run in the Azure environment. However,Scheduler Health monitoryou can make a few adjustments to the Visual Studio project to make the services work. After performing the steps described in this section,the Scheduler service will run as part of the role and the Health monitoring service will run as part of the role.SmartSearchWorker CMSApp
To enable external services in your Azure project:
Open your Azure project in Visual Studio.Open the CMSAzure/ file and uncomment the following code:ServiceDefinition.csdef
<Startup> <Task commandLine="InstallSchedulerService.cmd" executionContext="elevated"taskType="simple" /></Startup>
<Startup> <Task commandLine="InstallHealthMonitoringService.cmd"executionContext="elevated" taskType="simple" /></Startup>
Open the file in the CMSApp project and copy the value of key.web.config CMSApplicationNameOpen the SmartSearchWorker/ file (CMSApp_AppCode/ ) andInstallSchedulerService.cmd InstallHealthMonitoringService.cmdreplace with the value of the key.<ApplicationName> CMSApplicationName
For example, if the value of the CMSApplicationName key is:
<add key="CMSApplicationName" value="My Web Site/Kentico8" />
then the appropriate line would be:
1. 2.
a. b.
3.
Prerequisites for the Health monitoring service
For the Health monitoring service to work in your Azure project, the Azure Cloud Service and SQL Server must share the sameAffinity group and also, the SQL server must have the setting enabled. You can enable this option onWindows Azure Servicesthe if you select select your server .Azure Management Portal SQL Databases -> Servers -> -> Configure
If you have not configured the Cloud Services and SQL Server to share the same Affinity group, you cannot change that. You caneither:
Delete the services and create them anew while using the same Affinity group.ORYou can follow this procedure after you configure your Azure project as described in this (Configuring external Windowsservices) section:
Deploy your project to the Azure environment.Add the Virtual IP address of the Cloud Service, into which you have deployed your project, into the list of allowedIP addresses of your SQL server:
Find the Virtual IP address in select your service .Cloud Service -> -> DashboardInsert this value in select your server .SQL Databases -> Servers -> -> Configure
Deploy your Azure project once again.
Scheduler
Health monitoring
4.
5.
6. 7.
1. 2.
3. 4. 5. 6. 7. 8.
9.
SET _applicationIdentifier=My Web Site/Kentico8
You can also use the value of the CMSApplicationGuid key, but note that the services will use this value in their names.
Choose a password for a new administrator account, which will be created on your Microsoft Azure machine by theInstallSchedulerService.cmd (InstallHealthMonitoringService.cmd) script. Replace with the chosen password:<YourPassword>
SET _adminPassword=QyCZ5HDj
Open the Visual Studio's (by selecting in the main menu or by pressing ).Properties Window View -> Properties Window F4Set the property to for the following files:Copy to Output Directory Copy always
CMSApp/Web.configCMSApp/App_Data/CMSModules/WinServices/services.xmlCMSApp/App_Data/CMSModules/HealthMonitoring/Counters.xpcCMSApp_AppCode/InstallHealthMonitoringService.cmdSmartSearchWorker/InstallSchedulerService.cmd
Once the application is deployed and starts for the first time, the InstallSchedulerService.cmd and InstallHealthMonitoringService.cmd scriptsregister the services into the system and start them. You will then be able to manage them via remote desktop.
Configuring monitoring for Cloud Services
You can monitor the performance of your cloud services in the , when you select your cloud service and switch toAzure Management Portalthe page. The Azure platform offers two monitoring modes, Minimal and Verbose.Monitor
Minimal - the default monitoring mode for new cloud services. Allows you to monitor the following metrics: CPU Percentage, Data In,Data Out, Disk Read Throughput, and Disk Write Throughput.Verbose - provides more monitoring options, but requires access to the Azure blob storage. You need to provide storage accesskeys and configure the diagnostics connection string for your roles.
You can find more information about the monitoring options in .How to Monitor Cloud Services
To configure your Azure project to enable :verbose monitoring
Open your Azure project in Visual Studio.Right-click the role in the solution explorer and select , which adds a diagnosticsCMSApp Add Diagnostics Configurationconfiguration file to the solution. See for more instructions.Configuring Diagnostics for Azure Cloud ServicesDouble click the role.CMSAppOn the tab, make sure that the option is selected.Configuration Enable DiagnosticsClick Configure...On the General tab of the Diagnostics configuration dialog box, click .ConfigureSelect your and , where the diagnostics data will be stored.Subscription Storage accountClose both configuration dialog boxes.
1. 2. 3. 4. 5.
Deploying a project without a database
If you deploy your Azure project without a database (you perhaps intend to install the database later using the web installer), theWindows services will not be started and will not run even after you install the database.
To start the Windows services after you additionally install the database, restart the instances of the cloud service:
Open the .Azure Management PortalSelect your Cloud Service.Switch to the tab.InstancesSelect the instance and click in the bottom panel.RebootReboot all other instances including the worker role.
The restart will cause the Windows services to start properly and the performance counters to be registered.
Known issue
If you encounter the following error while publishing your Azure project from Visual Studio:
Could not copy the file "InstallHealthMonitoringService.cmd" because it was not found.
try publishing your project once again. This error sometimes occurs when you build your Azure solution in the configurationreleaseand subsequently publish the project.
9.
1. 2. 3. 4.
5. 6.
1. 2.
3.
4. 5. 6. 7.
Repeat this procedure also for the role.SmartSearchWorker
After you deploy your project, you can switch to the Verbose monitoring mode in the Azure Management Portal when you select your cloudservice and switch to the tab. You can also change the diagnostics connection string on the tab in the Configure Configure Diagnostics
section.Connection Strings
Deploying Azure projects to Cloud ServicesAfter you have , and , you can proceed to deploying yourprepared the cloud environment installed an Azure project configured the projectproject to the Azure Cloud Services.
To deploy an Azure project to the cloud, publish the project directly from Visual Studio to Microsoft Azure Cloud Services.
Deploying the Azure project from Visual Studio to Microsoft Azure
Deploying an Azure project from Visual Studio is a recommended practice. This procedure consists of two parts.
Importing a credentials file
Open your Azure project in Visual Studio.Right-click the project in the Solution Explorer and select .CMSAzure PublishClick the button.Sign inSign in to the Azure Management Portal and download the credentials file.
The download should start automatically. If not, switch to the tab, click and click Certificates Import... Download.subscription file
Click and select the downloaded file.Import...Click .Next
Configuring the deployment
Select the you have created (according to the instructions in ).cloud service Preparing the cloud environmentChoose the :Environment
Production - live environment.Staging - environment designed for testing the deployed project before promoting it to the production environment. You canswap the production and staging environments easily.
Select the :Build configurationDebug - includes debugging information.Release - includes code optimizations and is better suited for live environment.
Select in the Service configuration drop-down list.CloudCheck .Enable Remote Desktop for all rolesSpecify the credentials for connecting to the remote desktop.[optional] Check .Enable Web Deploy for all web roles (requires Remote Desktop)
After you publish your project, this option will allow you to publish changes for the web role directly without having topackage or publish the whole project again. See for instructions.Web DeployYou can find detailed information in the MSDN article.Update a Web Role
.
Use Web Deploy only for and only if you use .development and testing purposes one web role
7.
8. 9.
Click and check the summary.NextClick .Publish
Visual Studio packages your project and uploads the package to the selected Cloud Service. This may take some time (about half an hour).
Continue to .Installing the database for Azure projects
Installing the database for Azure projectsAfter you have to the cloud, continue to installing the database. Kentico projects hosted in Azure can use anydeployed your Azure projecttype of SQL database, hosted on a standard SQL Server or in the cloud. This topic describes the installation on an SQL Azure server.either
If you have already configured the connection string for your project, you can skip the and Generating the connection string Setting the sections.connection strings
Installing a database on an Azure SQL server
To install the database on an Azure SQL server, use the system to generate the connection string, paste the connection string as a value toyour cloud service and let the system install the database.
1.
2.
Generating the connection string
Access the website of your deployed Azure project. You can find the URL if you choose select your service under Site URL.Cloud services -> -> Dashboard
Specify the target Azure SQL server (which you have created according to the instructions in ) andPreparing the cloud environmentsupply the credentials for the server:
SQL Server name or IP address – enter the SQL Azure server name, which you can find at select yourSQL Databases -> database under . The standard format is . -> Dashboard Server name <servername>.database.windows.net
2.
3.
4.
Click .Next
4. 5.
6. 7.
1. 2. 3.
Enter the name of the SQL database (which you have created according to the instructions in ).Preparing the cloud environmentChoose whether you want to .Create Kentico CMS database objects
Select this option if you are installing into an empty database.Clear this option if the existing database already contains Kentico objects (tables, stored procedures, views).
Click .NextCopy the second connection string value into the clipboard.
Setting the connection strings
Open the in another browser tab.Azure Management PortalNavigate to select your service . Cloud services -> -> ConfigurePaste the copied connection string value into the fields of the setting for the CMSApp role and also theCMSConnectionStringSmartSearchWorker role if you are using it.
3.
4. 5.
1. 2. 3. 4. 5.
1.
2.
3.
Click .SaveClose the original window with the database installation.
You have configured the connection strings for your database.
We recommend that you configure the connection string also in your local Azure project to have it prepared for future deployments:
Open your Azure project in Visual Studio.Double-click the role.CMSAppSwitch to the tab and select as Service Configuration.Settings CloudPaste the connection string as a value for the key.CMSConnectionStringRepeat for the role if you are using it.SmartSearchWorker
Now you will not have to set the connection string in your local project the next time you deploy your project to the cloud.
Finishing the database installation
Open the website of your project anew ( ).<your cloud service name>.cloudapp.netThe database installation automatically resumes.
Confirm the target database by clicking .NextThe installer now installs the database for your project.
Enter a license key for the domain.Staging deployments are automatically covered by any other valid license, so you do not have to request a separate licensefor staging deployments. However, this applies only if you use the recommended configuration, which is to use separate
3.
4. 5.
6.
1. a. b. c.
2. 3. 4. 5. 6. 7.
8.
9.
10. 11.
12.
databases for live and staging environment.
Click .NextChoose an initial website to install:
Choose a starter site – you can choose from the supplied sample sites to try out the functionalities of the system or use itas a base for custom development. We recommend the or the .Corporate site E-commerce siteContinue to the New site wizard – choose this option if you want to to develop a new site from scratch. See Creating new
for more information.sites using the New site wizardImport existing Kentico CMS website – choose this option if you have already created a website using Kentico and youwant to import it to the new installation. See for more information.Importing a site or objects
Click .Next
The installer creates your chosen website and finishes the installation. See our andRecommendations on using Azure SQL Database tiersadjust the tier of your database to suit your project demands.
If you continue to your new website, you can log in to the administration interface.
Developing Kentico Azure projects locallyYou can start developing the application in the local computing emulator provided by Azure SDK. You can use the emulator to test thewebsite during its development without actually hosting it in the cloud.
You can use either a standard SQL database or Microsoft Azure SQL Database (note that when developing locally with a database in thecloud, you may experience slower performance based on the location of the server and database services). However, we recommend thatyou use a Microsoft Azure Storage account as a file system for your project.
Developing Azure projects locally in the emulator
Prepare an SQL database or prepare a database on Microsoft Azure:Create a new Azure SQL Server.Add firewall rules for the server.Create an SQL Database.
Create an Azure Storage account through the Microsoft Azure Management Portal.Open your Azure project in Visual Studio.Right-click the role and select .CMSAzure\Roles\CMSApp PropertiesSwitch to the tab.SettingsSelect as the Service Configuration.LocalSet the value of key to the connection string for your database.CMSConnectionString
You can find the connection string of Azure SQL Database on the in selectAzure Management Portal SQL Databases ->the database tab link.-> Dashboard -> Show connection strings
Set the values of and keys for your Azure Storage.CMSAzureAccountName CMSAzureSharedKeyYou can find these values on the in select your storage (inAzure Management Portal Storage -> -> Manage access keysthe bottom panel) as and .Storage account name Primary access key
Clear the values of , and keys.CMSAzureQueueEndPoint CMSAzureTableEndPoint CMSAzureBlobEndPoint
Repeat steps 4 - 9 for the role.SmartSearchWorkerRight-click the project in the Solution Explorer and select .CMSAzure Set as StartUp Project
Login to our sample starter sites:
User name: administratorPassword: (blank password)
12. 13.
1. 2. 3. 4. 5.
Run the project in the debug mode.Go through the Kentico database installation when the system automatically opens the database installation in a browser.
In case of Azure SQL Server, use the following format of the server name: .servername.database.windows.net
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 Microsoft Azure environment.
Prepare an SQL database or and .create a new Azure SQL Server SQL DatabaseCreate an Azure Storage account through the Azure Management Portal.Open your Azure project in Visual Studio using the file.WebApp.slnOpen the file.CMSApp\Web.configAdd the key and value to the <connectionStrings> section of the web.config file.CMSConnectionString
CMSHashStringSalt key
We recommend that you make sure that the key is set to a single static value in your web.config file. See CMSHashStringSalt The.CMSHashStringSalt key is identical in all environments
5.
6.
7. 8. 9.
10.
<connectionStrings> <add name="CMSConnectionString" connectionString="DataSource=tcp:YourServerName.database.windows.net,1433;InitialCatalog=YourDatabaseName;UserId=YourUsername@YourServerName;Password=YourPassword;" /></connectionStrings>
Replace , , and with your own values.YourServerName YourDatabaseName YourUsername YourPasswordYou can find the connection string of Azure SQL Database on the in selectAzure Management Portal SQL Databases ->the database tab link.-> Dashboard -> Show connection strings
Add the and keys to the <appSettings> section of the web.config file.CMSAzureAccountName CMSAzureSharedKey
<appSettings> ... <add key="CMSExternalStorageName" value="azure" /> <add key="CMSAzureAccountName" value="YourStorageAccountName" /> <add key="CMSAzureSharedKey" value="YourPrimaryAccessKey" /></appSettings>
Replace and with your own values.YourStorageAccountName YourPrimaryAccessKeyYou can find these values on the in select your storage (inAzure Management Portal Storage -> -> Manage access keysthe bottom panel) as and .Storage account name Primary access key
Right-click the project in the Solution Explorer and select .CMSApp Set as StartUp ProjectRight-click the folder and select .CMSApp_AppCode\Old_App_Code\CMSModules\WindowsAzure Exclude From ProjectRun the project in the mode.debugGo through the Kentico database installation when the system automatically opens the database installation in a browser.
In case of 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 makechanges to the project locally. For this scenario to work, you must use only of the CMSApp web role.one instance
CMSHashStringSalt key
We recommend that you make sure that the key is set to a single static value in your web.config file. See CMSHashStringSalt The.CMSHashStringSalt key is identical in all environments
Storing media files, metafiles and attachments when developing Azure projects as web applications
If you store media files, metafiles and attachments in the file system (the Settings -> System -> Files -> Store files in the filesetting is selected) when you develop your Azure project as a web application, these files are stored downright in yoursystem
project folders as media files. This may cause problems after you deploy your project to the Microsoft Azure platform, as these filesare regarded as read-only and deleting such files from the administration interface may not be allowed.
Therefore, we recommend that you configure your project to either:
Store files only in the database - clear the setting and select the Store files in the file system Store files in the setting in .database Settings -> System -> Files
orStore such files in the Azure blob storage - select the setting and configure the Store files in the file system CMSAzureA
and keys in your web.config file as specified in this section.ccountName CMSAzureSharedKey
You can find more information about the file storing settings in .Storing files
Error associated with this problem:
" "Failed to publish document: File.Delete: File <filename> cannot be deleted because it exists in application file system.
WindowsAzure folder
1. 2. 3. 4. 5.
6. 7.
8. 9.
10.
1. 2. 3.
4. 5. 6.
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 Azure SQL Database.
Create Cloud Service.Create a new Azure SQL Server and configure its firewall to accept your IP address.Open and expand the node.Microsoft SQL Management Studio DatabasesRight-click your database and select .Tasks -> Deploy Database to Windows Azure SQL DatabaseOn the tab of the deployment dialog-box, connect to the created Azure SQL server (the server name has theDeployment Settingsfollowing form: ) and type the name of a database into which the local database will be<servername>.database.windows.net newdeployed.Open your Azure project in Visual Studio using the file.CMSAzure.slnIn of the web role, on the tab, in the service configuration, fill the aProperties CMSApp Settings Cloud CMSAzureAccountNamend keys with appropriate values for your Azure Storage (the same as for the Local configuration).CMSAzureSharedKeySet the value with the connection string of the new database.CMSConnectionStringConfigure the SmartSearchWorker role.Deploy your project to the created Cloud Service.
Make sure that the and Enable Remote Desktop for all roles Enable Web Deploy for all web roles (requires Remote options are selected.Desktop)
Now you can deploy changes to the project files quickly using the functionality.Web deploy
Deployment when using the same database
This procedure presumes that you are using the Azure SQL Database from the beginning and you do not need to migrate the database.
Create Cloud Service.Open your Azure project in Visual Studio using the file.CMSAzure.slnIn of the web role, on the tab, in the service configuration, fill the aProperties CMSApp Settings Cloud CMSAzureAccountNamend keys with appropriate values for your Azure Storage (the same as for the Local configuration).CMSAzureSharedKeySet the value with the connection string of your database (the same as for the Local configuration).CMSConnectionStringConfigure the SmartSearchWorker role.Deploy your project to the created Cloud Service.
Make sure that the and Enable Remote Desktop for all roles Enable Web Deploy for all web roles (requires Remote options are selected.Desktop)
1. 2.
3. 4.
If you are developing your project locally as a web application, you need to return the WindowsAzure folder to your project beforethe deployment. The folder contains the AzureInit.cs file, which is essential for running your project on Microsoft Azure.
Open your Azure project in Visual Studio using the file.CMSAzure.slnSelect on the Solution Explorer panel. Show all files
This option displays folders and files which are excluded from the project.Open the folder.CMSApp_AppCode\Old_App_Code\CMSModulesRight-click the folder and select .WindowsAzure Include in project
The system includes the AzureInit.cs file back into the project.
Tip
You can also use third-party tools for deploying local databases to Azure SQL Databases, for example SQL Database Migration.Wizard
1. 2. 3. 4. 5. 6.
7. 8. 9.
10. 11.
Alternative database deployment
If the database deployment process through Microsoft SQL Management Studio described in this procedure does not suit you, youcan export and import your website instead. This way you can choose particular object types which you want to deploy.
Create Cloud Service.Create a new Azure SQL Server.Create SQL Database.Open the Kentico administration interface and open the application.SitesClick .Export siteIn of the web role, on the tab, in the service configuration, fill the Properties CMSApp Settings Cloud CMSAzureAccou
and keys with appropriate values for your Azure Storage (the same as for the LocalntName CMSAzureSharedKeyconfiguration).Set the value with the connection string of the new database.CMSConnectionStringConfigure the SmartSearchWorker role.Deploy your project to the created Cloud Service.
Make sure that the and Enable Remote Desktop for all roles Enable Web Deploy for all web roles (requires are selected.Remote Desktop)
Install a new database for your project.Import the previously exported website in application .Sites -> Import site or objects
1. 2. 3. 4. 5.
1. 2. 3. 4. 5.
a. b. c.
6.
7.
8.
Now you can deploy changes to the project files quickly using the functionality.Web deploy
Web Deploy
If you are performing web deploy from the from which you performed the initial deployment, this procedure issame computerstraightforward as you can use an already created publish profile:
Right-click the project and select .CMSApp PublishSelect the existing publish profile from the drop-down list.Switch to the tab.ConnectionProvide the password for remote desktop connection.Click .Publish
If you are performing web deploy from a than the one from which you performed the initial deployment, you need todifferent computercreate a new publish profile:
Right-click the project and select .CMSApp PublishClick the drop-down list and select <New profile...>.Type the name of the profile and click .OKOn the tab, select as the Publish method.Connection Web DeployProvide the address:Server
Open the in a browser.Azure Management PortalSelect your cloud service tab.Cloud services -> -> DashboardCopy the without the protocol (http://) and trailing slash (/) to the Server field of the web deploy profile in theSite URLfollowing format:
https://YourSiteURL:8172/MsDeploy.axd
Provide the :Site nameThis corresponds to the name of your website registered in IIS of the server.You can find the name by remotely connecting to the server ( your cloud service tab ->Cloud services -> -> Instances Click in the bottom panel and run the downloaded file).ConnectThe default value is . CMSApp_IN_0_Web
Type the username and password for remote desktop connection.
8. 9.
10.
1. 2.
a. b. c. d.
e.
f.
3.
1. a. b. c. d. e.
f.
Switch to the tab.SettingsChoose the build Configuration.Click .Publish
Final deploy
When your project is fully developed and ready to go live, again, with the and Deploy your project Enable Remote Desktop for all roles Ena options CLEARED. After that, your CMSApp web role can use more thanble Web Deploy for all web roles (requires Remote Desktop)
one instance.
Setting up post-production development of Azure projects
If you realize that you need to make changes to your Azure project already in the production, you can utilize the functionalitycontent stagingto synchronize the database changes between your local development and production projects. However, you will still need to deploy yourproject files.
Moreover, you may want to set up a new blob storage to separate the content files of your local and production projects. The synchronizationof these files will be handled by the content staging functionality.
Although there are other ways to develop your projects after you promote them to the production, we recommend the following configuration:
Create a new Azure Storage.Set the of your project to connect to a local database and the newly created blob storage:local configuration
Open your Azure project in Visual Studio using the file.CMSAzure.slnDouble-click the role.CMSAzure\Roles\CMSAppSwitch to the tab and select as the Service Configuration.Settings LocalMake sure that the value of key is set to the connection string for your local database (you can useCMSConnectionStringyour existing development database or copy your production database to a local server).Set the values of and keys for the newly created Azure Storage.CMSAzureAccountName CMSAzureSharedKey
You can find these values on the in select your storage Azure Management Portal Storage -> -> Manage access (in the bottom panel) as and .keys Storage account name Primary access key
Set these settings also for the role.SmartSearchWorker
Configure the content staging between your projects. Configure your local project as the source server and production project as thetarget server.
Your local project is now configured to be developed separately from the production project.
Deploying updated production projects
After you have configured the content staging functionality for your projects, you can propagate object changes to the production projectthrough the content staging functionality (see ). If you develop custom code, you also need to redeploy your projectSynchronizing the contentto the Staging environment and swap staging with production.
Make sure that the cloud configuration in your project is set to connect to the production database and production Azure storage.Open your Azure project in Visual Studio using the file.CMSAzure.slnDouble-click the role.CMSAzure\Roles\CMSAppSwitch to the tab and select as the Service Configuration.Settings CloudMake sure that the value of key is set to the connection string for your production database.CMSConnectionStringSet the values of and keys for the production Azure Storage.CMSAzureAccountName CMSAzureSharedKey
Staging large files (larger than 2 GB)
By default, the system will not stage files that are larger than 2 GB. If you need to stage larger files, change the maximum values in your projects.content and request size
CMSHashStringSalt key
The key defines the salt value that the system uses in hash functions, for example in CMSHashStringSalt macro and media library links. For the content to be synchronized properly through Content staging, the value of thissignatures
key must be identical in all environments you use. Otherwise, the hash values of objects will be different in differentenvironments.
Therefore, make sure that the value of this web.config key is set to a single static value, for example a random GUID. Ifthe key is not present in the web.config file, it means that its default value is the connection string of your project. In thiscase, we recommend that you add this key to your local project with the connection string of your production project as avalue.
Note: We do not recommend changing the key value for the production project, as it will breakCMSHashStringSaltmacro signatures and media library links.
1.
f.
2.
3.
a. b. c. d.
4.
5. a. b. c.
6. 7. 8.
1. 2. 3.
Set these settings also for the role.SmartSearchWorker
Deploy your project with the and Enable Remote Desktop for all roles Enable Web Deploy for all web roles (requires Remote options CLEARED.Desktop)
Disable Smart search functionality in the staging deployment (Smart search cannot run simultaneously on two projects connected tothe same database):
Open the Kentico administration interface and the application.SettingsSelect the category.System -> SearchClear the setting.Enable smart search indexingClick .Save
Test that the staging website works as expected.
Swap production deployment with staging deployment:Open .Azure Management PortalSelect your Cloud service and switch to the tab.DashboardClick in the bottom panel. The system instantly swaps the production and staging deployments. Swap
Stop or delete the Staging deployment (so that you can enable Smart search again).Enable Smart search functionality in the production deployment.Open the administration interface of your project and .local synchronize the content changes
You have redeployed your locally developed changes to the production.
Scaling Azure Cloud ServicesThe Microsoft Azure platform allows you to scale your Kentico projects in terms of computing power, memory and IO resources. There areseveral ways to scale your project. You can configure your Azure Cloud Service to:
use larger instances,use more instances,automatically scale the number of instances.
Scaling the size of instances
The default size of an instance of your project is . See for a list of available instance sizes.small Cloud Services Pricing Details
You can change the size of your instances only through Visual Studio. See for instructions. NoteConfiguring sizes of the CMSApp web rolethat when changing the size of instances.full redeployment is needed
Scaling the number of instances
You can configure your project to use a specific number of instances through Visual Studio – see . ThisConfiguring the number of instancesapproach requires full redeployment of your project.
You can also scale your already deployed project through the management portal:
Open the .Azure management portalSelect your cloud service.Switch to the tabScale
On this tab, you can either set the number of instances your cloud service uses, or configure automatic scaling. See moredetails in the article.How to Scale an Application
Converting an existing project to an Azure projectIf you already have a Kentico web site or web application hosted on a traditional web server or prepared for deployment, you can decide tomove your project to the Microsoft Azure Cloud Services. There are several tasks you need to perform before the deployment.
Do not make any changes to the website at this moment. The staging website is connected to the production databaseand blob storage, which could cause inconsistencies if objects are modified through the staging project.
License constrictions for the number of instances
If you want to increase the number of instances your Azure project is using, you need to have a license which allows at least thespecified number. If you increase the number of instances beyond the number your license allows, the web farm serverfunctionality will stop working completely.
Please contact your account manager to obtain a license for a higher number of web farm servers before increasing the number ofinstances in your Azure project.
1.
2. 3.
4.
This scenario expects that you have a Kentico web site or web application project installed in a local file system, connected to a standardMicrosoft SQL database. If you want to move your project to Azure Cloud Services, you need to move the media library files, deploy yourdatabase to Azure SQL (if you want to have the whole project on Azure, otherwise it is not necessary) and deploy the project files throughVisual Studio.
However, please read the section first and adjust your project according to the recommendations.Possible issues
Possible issues:
The following issues present problems which you should be aware of during the process of converting an existing project to an Azure projectfor deployment to Cloud Services. Please read through them, asses whether they apply to your project and adjust your project according tothe recommendations.
Storing and in the file system (when the settingmetafiles attachments Settings -> System -> Files -> Store files in: File system is selected) is not recommended on the Azure platform. In this case you need to migrate the files to the database or the blobstorage:
Store files only in the database - select the setting in .Store files in: Database Settings -> System -> FilesOr store such files in the Azure blob storage - select the setting and move the files to the blobStore files in: File system storage.
In the Azure environment, are stored in the blob storage. After you move your existing media files to the Azure blobmedia filesstorage, the existing links to the media files from content will stop working. You will need to manually re-save them.If you store (form layouts, page layouts, transformations, etc.) in the file system (when the virtual objects System -> Virtual
option is enabled), you need to move the objects back to the database beforeobjects -> Store all virtual objects in file systemdeploying your project to the Azure platform. Virtual objects cannot be stored in the file system on Azure. However, you can storevirtual objects in the file system in your local development project if you .develop the project as a web applicationIf you have set up a in your project, the system can contain unnecessary web farm servers in the database. The web farmweb farmservers are generated automatically on Azure. Therefore, we recommend that you delete the old web farm servers in the UI toensure that a licensing error does not occur.Review any that works with the file system. Make sure that the code uses CMS.IO. Also migrate relevant files to thecustom codeblob storage.Your may contain custom database objects that are not supported on Azure SQL. This is a limitation of the Azure platform,databaseyou might not be able to migrate your database to Azure SQL without modifications. These issues might happen if you havesomehow customized your database (stored procedures, indexes, access to tables) or if you have developed custom modules.
Prerequisites - Cloud environment
Before you start converting and deploying your project to the Azure platform, make sure that you have all the necessary services prepared inthe :Azure Management Portal
Create an Azure Storage - the blob storage is necessary for storing media and other types of files.Create an Azure SQL Server and configure its firewall to accept your IP address - if you want to deploy your database to the Azureplatform, you need to prepare an Azure SQL server. You do not need to prepare an empty database though, as the database will becreated during the deployment process.Create an Azure Cloud Service - this service will host your project and provide computing power.
Part 1 - Move the media files
When the website runs in the Azure environment, media files are automatically stored in the blob storage. Therefore, we recommend that youmove your existing media files to the blob storage as well to have all files in one place.
Open the created Azure blob storage.You can use an arbitrary file manager for Microsoft Azure blob storage. We recommend Cloudberry explorer for Microsoft
.AzureCreate a new container in the root called .cmsstorageMove all media library files to the created container including the site name folder.
The default location of all libraries of a particular site is .~/<sitename>/mediaThe folder structure on the blob storage will look like this:cmsstorage/<sitename>/media/<medialibraryname>/<medialibraryfiles>.
Convert any uppercase letters to lowercase, because Azure blob storage is case sensitive.
You have prepared your media library storage.
Part 2 - Deploy the database
This page provides instructions on converting an existing Kentico project to Kentico Azure project designed for deployment to Azur. If you want to deploy your Kentico project to Azure Web Apps, please see e Cloud Services Deploying existing Kentico projects
.to Azure Web Apps
1. 2. 3.
4.
1. 2.
3. 4.
a. b. c.
1.
2.
You can host your project on Microsoft Azure and keep your database in a standard Microsoft SQL server.
However, we recommend that you move your database to Azure as well, as hosting your database on Azure ensures the best performancefor your project. In this case, you can deploy the database directly from Microsoft SQL Management Studio:
Open and expand the node.Microsoft SQL Management Studio DatabasesRight-click your database and select .Tasks -> Deploy Database to Windows Azure SQL DatabaseOn the tab of the deployment dialog-box, connect to the created Azure SQL server (the server name has theDeployment Settingsfollowing form: ) and type the name of a database into which the local database will be<servername>.database.windows.net newdeployed.Change the connection string in your web.config file to connect to the Azure SQL database. You can use the following template:
<connectionStrings> <add name="CMSConnectionString"connectionString="Server=DATABASE_SERVER.database.windows.net;Database=DATABASE_NAME;UserID=DB_SERVER_USER_NAME;Password=DATABASE_SERVER_PASSWORD;Trusted_Connection=False;Encrypt=True;Connection Timeout=120;" /></connectionStrings>
Replace the upper-case words with your own data.
Test if the database works as expected with your project. Now you have a project which uses an Azure SQL database.
Part 3 - Convert the project
The best way of converting a normal project to an Azure project is to install a blank new Kentico Azure project and transfer yourcustomizations.
Install empty Kentico Azure project using Kentico Installer.Move all your customizations of the code base in your project to the new Kentico Azure project.
We recommend that you compare empty, not customized project with your project using some external compare tool.Copy any additional files required by the site, such as custom user controls or stylesheet design files.Include the copied files in your project:
Open Visual Studio and enable the button at the top of the Solution Explorer.Show all filesRight click the given files and select .Include In ProjectCheck the properties ( ) of all files that were included into the project and make sure that the valueRight click -> Propertiesof their property is set to .Build Action Content
Your project is now converted to an Azure project.
Finish - Configure and deploy the Azure project
When your project is converted, transfer the listed settings from the web.config file to the ServiceConfiguration.Cloud.cscfg file and performthe described configurations. After that, your project is ready to be deployed to the cloud.
Make sure that you copy the value of the key from the web.config file in your original project to the web.configCMSHashStringSaltfile in your Azure project.
If you do not copy this value, all macros and other features that use hashing will become invalid in the Azure project and youwill have to re-save them.
Specify the connection string in the file in the and sections.ServiceConfiguration.Cloud.cscfg CMSApp SmartSearchWorkerYou can use the following template:
Microsoft SQL Server version
This procedure works only with or newer. If you have an older version, upgrade your SQL serverMicrosoft SQL Server 2012 SP1(you can also use the free Express edition) or use an external tool for migrating the database, for example SQL Azure Migration
.Wizard
2.
3.
4.
<ConfigurationSettings> <Setting name="CMSConnectionString"value="Server=DATABASE_SERVER.database.windows.net;Database=DATABASE_NAME;UserID=DB_SERVER_USER_NAME;Password=DATABASE_SERVER_PASSWORD;Trusted_Connection=False;Encrypt=True;Connection Timeout=120;" /></ConfigurationSettings>
Replace the upper-case words with your own data.
Configure the blob storage settings and settings in the file as specified in Smart search ServiceConfiguration.Cloud.cscfg Basic.configuration
When your project is configured, .Deploy your Azure project
Your whole project is now deployed to the Azure platform.
If you now wish to further develop your project locally, copy the settings to the file and change theServiceConfiguration.Local.cscfgconnection string to connect to a local database (instead of the production database on Azure). We also recommend that you prepareanother Azure blob storage and connect it to your local project. See for more information. You canDeveloping Kentico Azure projects locallyset up to synchronize the media files between the blob storages.Content staging
Repairing media library links and macro expressions
If you have created links from content (pages) to the media library files as , they should work correctly even after deployingpermanent linksyour project to the Azure environment.
However, if you have created them as direct links (with the file name in the URL), you need to correct them to point to the new address of themedia files:
Open your Azure website and re-save the existing links to the media library files from content (pages). Correct links to the media fileson a blob storage should begin with ./CMSPages/GetAzureFile.aspx
Also check that existing work correctly.macro expressions
Troubleshooting Azure projects
Error when getting container
Error: "[ContainerInfoProvider.GetContainer]: Error when getting container (it may be caused by inability to connect to the cloud)."
This error may occur when a server with incorrectly configured time is trying to reach an Azure Blob storage. This is due to Azure rejectingconnections from off-synced servers.
Solution
Make sure you have your servers set to current day and time. Different offset zones are not an issue, because time on Kentico serversmatches time on Azure Blob storages after time zone conversions.
Database reached its size quota
Error: "The database 'XYZ' has reached its size quota. Partition or delete data, drop indexes, or consult the documentation forpossible resolutions."
The Azure SQL database has a maximum size that is allocated to it. When the database reaches its maximum size, the site stops workingand throws this error.
Solution
You can increase the database size limit on the in edit the database .Azure Management Portal Databases -> -> Scale -> Max size
Error when deploying Kentico to Azure Cloud Services
Media library links with Azure CDN
Configuring Azure CDN also changes the location of media library files. If you plan to configure the Azure CDN for your project, re- for your project. Otherwise, you will have to re-save the links again.save the media library links you configure the CDNafter
Error: "Access to the path '..\AppData\Local\Temp\tntezvsm.ldc\roles\CMSApp\approot\bin\Microsoft.WindowsAzure.CloudDrive.dll'is denied."
This error occurs when deploying a Kentico 8 Azure project from Visual Studio to Azure Cloud Services.
Solution
In Visual Studio, set references to .Microsoft.WindowsAzure.*.dll files in all projects to Copy local: false
1. 2.
Site seems to be going down and back up every couple of minutes in Cloud Services
A cloud instance may have issues with a response time (delays, timeouts, downtime) when AzureCache and AzureTemp folders are full orcontain too many files (for example, web analytics log files, OM activities, etc).
Solution
Clear all files from and folders located inAzureCache AzureTemp C:\Resources\directory\. This should fix the issues.You need to remove the content of these folders from all instances of your service, not just one.
For more information see .Developing on Microsoft Azure - best practices
Not enough space on the disk
Error: "There is not enough space on the disk."
This error occurs when adding new media files or when importing a site to a Kentico instance hosted on Microsoft Azure. See Developing on for more information.Microsoft Azure - best practices
Media files cannot be deleted
Error: "[MediaLibraryInfoProvider.DeleteMediaLibraryFolder]: [Directory.Delete]: Cannot delete path <a file system path> becauseit's in Windows Azure file system."
This errors occurs when trying to delete media files in a project deployed to Azure and connected to Azure Blob Storage.
Solution
The problem is caused by deploying an Azure project with media files included in it. It is recommended to delete all these files from theproject folder and reupload all these files from this project folder to the respective folder on the blob storage. Then, perform a bulk import ofthose files (Media libraries -> your library -> All files: Import) which should create appropriate records in the Media_File database table.Additionally, a redeployment of the entire project is necessary as well.
We also recommend using the external blob storage all the time even when you are developing your site locally to prevent similar errors fromhappening again after redeploying the site. See more information in .Developing on Microsoft Azure - best practices
Developing for Microsoft Azure Cloud Services - best practicesThere are usually several different ways of how to set up the development environment for your Kentico projects running on Azure. This page provides our recommendations on the best options, explains several pitfalls you might encounter and offers solutions to certain problems.
Please note that some recommendations apply only to certain Azure environments, so .proceed with the topics that apply to your environment
Azure Web Apps
WEB APPS
DatabaseDatabase connections limit
Web farmsThe number of instances (web farm servers) being used is not higher than the number of web farm servers included in your license
StorageEach project has its own blob storage or blob storage containerThe CMSHashStringSalt key is identical in all environmentsMedia files stored on blob storage are divided into folders
Temporary and cached filesDeleting files from the AzureCache and AzureTemp foldersPreventing Azure cache folders from bloating
Smart Search
Azure Cloud Services
CLOUD SERVICES
DatabaseProduction and staging deployments have individual databasesOne deployment has one production databaseDatabase connections limit
Web farmsThe number of instances (web farm servers) being used is not higher than the number of web farm servers included in your licenseWeb.config keys related to web farms are not setWeb farm mode setting is set by the system
StorageEach development, staging or production environment has its own blob storageEach project has its own blob storage or blob storage containerThe CMSHashStringSalt key is identical in all environmentsMedia files stored on blob storage are divided into foldersThe Web analytics storage folder is mapped to the server file system
Temporary and cached filesDeleting files from the AzureCache and AzureTemp foldersIncreasing the size of AzureCache and AzureTemp foldersPreventing Azure cache folders from bloating
Smart Search
Standard server connected to an Azure Blob Storage
BLOB STORAGE Details: Configuring Azure storage
StorageEach project has its own blob storage or blob storage containerMedia files stored on blob storage are divided into folders
Temporary and cached filesDeleting files from the AzureCache and AzureTemp foldersPreventing Azure cache folders from bloating
Database
General rule: every deployment and every project must be connected to its own database, and only one database.
Production and staging deployments have individual databases
Applies to: CLOUD SERVICES
When you use the staging environment for testing your website before promoting it to production, always use different databases for eachdeployment environment. This ensures that your staging environment, which you use for testing purposes, does not damage your productiondatabase.
1. 2. 3. 4.
To set your projects this way, modify the connection string in your local project to connect to a different database (you can create a copy ofyour production database through the Azure management portal) than your production project before you deploy the project to the stagingslot.
When you need to switch the staging and production projects but not the databases, you can set different connection strings for each projectthrough the Azure management portal:
Open the .Azure management portalSelect your service.Switch to the tab.ConfigureSelect or and configure the key for each deployment to connect either to theProduction Staging CMSConnectionStringproduction database or the copied database.
One deployment has one production database
Applies to: CLOUD SERVICES
If you want to increase the number of web role instances in your production project to create a web farm, always use only one database forthe whole deployment.
By increasing the number of web role instances, you assign more virtual machines to your project. This creates a . Kentico Azureweb farmprojects on Microsoft Azure platform are preconfigured to handle web farms automatically – web farm servers are created dynamicallyaccording to the assigned virtual machines (instances). See for more information on web farm functionality.Setting up web farms
However, for the web farm to work, all web role instances of your cloud service must . The only thing you need to douse the same databaseis to set one connection string for your whole production project.
Database connections limit
Applies to: WEB APPS CLOUD SERVICES
If you want to increase the database connections limit using the attribute in the connection string, note that there areMax Pool Size
Note: Do not increase the number of instances of the Smart search worker role.
Geo-replication
Please note that Kentico does NOT support geo-replication for databases. You can use some of the following recommendationsinstead:
Scale your application to multiple instances for load balancing.Use to speed up delivery of files.Content Delivery NetworkUse two separate environments synchronized through .content staging
limitations to the Azure SQL Database.
The maximum limit of concurrent requests to the database (for the default Web edition of an Azure SQL Database) is 180. This limit is for allweb roles and worker roles combined (in case of Azure Cloud Services). This means that if you have 2 CMSApp web roles and oneSmartSearchWorker role, then you should set the pool to the maximum size of 60.
<connectionStrings> <add name="CMSConnectionString" connectionString="DataSource=tcp:YourServerName.database.windows.net,1433;InitialCatalog=YourDatabaseName;UserId=YourUsername@YourServerName;Password=YourPassword;Max Pool Size=60" /></connectionStrings>
There is no need to increase this value if you do not have specific reasons to do so. If you set a higher limit than allowed by Azure SQLDatabases, you might receive error 10928. See for details.Azure SQL Database Resource Governance
> Back to the top list
Web farms
The number of instances (web farm servers) being used is not higher than the number of web farm
servers included in your license
Applies to: WEB APPS CLOUD SERVICES
Do not increase the number of instances of your Azure project unless you have obtained a license with a corresponding number of web farmservers included. If you increase the number of instances beyond the number your license allows, the web farm server functionality will stopworking completely.
Please contact your account manager to obtain a license for a higher number of web farm servers before increasing the number of instancesin your Azure project.
Web.config keys related to web farms are not set
Applies to: CLOUD SERVICES
Please do not configure any web.config keys related to web farms in your Azure projects. The Azure projects have web farms configuredautomatically and setting these keys may disrupt the system.
Web farm mode setting is set by the system
Applies to: CLOUD SERVICES
Because Azure projects have web farm mechanisms configured , the setting which you can configure in theautomatically Web farm modeadministration interface does not have any effect on the system. You can find the setting in the application Settings -> Versioning &
. -> Web farmSynchronization
The other settings, that can be used on Azure, are described in .Settings - Web farm
> Back to the top list
Storage
Each development, staging or production environment has its own blob storage
Applies to: CLOUD SERVICES
We recommend that every environment you use (local project, staging deployment or production deployment) is connected to a different
Enabling web farms on Azure Web Apps
This section applies only to Azure projects deployed in Azure Cloud Services. Other projects do not have web farms configuredautomatically and these settings work as usual. If you create an by deploying a project from Visual Studio (see Azure Web App Cr
), you need to enable web farm functionality manually. See eating Web Apps from Visual Studio Enabling web farms on Azure Web for details.Apps
. If you use only one storage for all your environments, the system will be inconsistent. For example, deleting a mediaAzure blob storagelibrary file in the local project will lead to missing references in the production project, if the file is used there. You can also configure yourprojects to use on one blob storage - .different containers see the following section
We also recommend that you implicitly connect your local development project to an Azure blob storage instead of the default locallyemulated storage. Using the Azure blob storage from the beginning allows you to access the storage from anywhere and may preventdifficulties when moving files between local file system and the blob storage. If you do not abide by this recommendation, you will have toupdate all media links manually after you move the media files to the blob storage. Or, you will have to deploy the media files together withthe project in its file system, which can be problematic, as this usually greatly increases the size of the deployment package.
For synchronizing files and changes between the different storages of each environment, you can use the module. However,Content stagingthe key value in the web.config file must be identical in all environments for the Staging module to work properly. SeeCMSHashStringSaltthe next section for details.
Each project has its own blob storage or blob storage container
Applies to: WEB APPS CLOUD SERVICES BLOB STORAGE
If you have multiple projects connected to Azure Blob Storage, for example for testing and production, every project must have its own blobstorage or at least a different blob storage container configured.
To configure your projects to use different containers, add the following key to the web.config file with the name of the new container as itsvalue. Set a different value for each project.
CMSAzureRootContainer - this key specifies the name of the blob container that will serve as the root of the application's filesystem on the Azure Blob Storage account. The default value is cmsstorage.
<add key="CMSAzureRootContainer" value="CustomRoot"/>
The CMSHashStringSalt key is identical in all environments
Applies to: all projects that use WEB APPS CLOUD SERVICES Content staging
The key defines the salt value that the system uses in hash functions, for example in and mediaCMSHashStringSalt macro signatureslibrary links. For the content to be synchronized properly through Content staging, the value of this key must be identical in all environmentsyou use. Otherwise, the hash values of objects will be different in different environments. Therefore, make sure that the value of thisweb.config key is set to a single static value, for example a random GUID, before you deploy your project to the Azure environment.
<appSettings> <add key="CMSHashStringSalt" value="eb2d6fac-8b9e-427c-b98b-3c562dffbb35" /></appSettings>
Media files stored on blob storage are divided into folders
Applies to: WEB APPS CLOUD SERVICES BLOB STORAGE
Storing a large number of media files in a single folder can significantly affect the performance of your project when editing the files in theMedia library application.
1.
2.
1. 2. 3.
Instead of storing all files in one folder, create a structure and divide the files into multiple folders. The number of files in one folder directlyaffects the performance of the Media library user interface.
The Web analytics storage folder is mapped to the server file system
Applies to: CLOUD SERVICES
By default, are also stored on the blob storage. The Web analytics module writes and processes logs every minute,web analytics logswhich can cause problems on the blob storage with latencies. Moreover, the Web analytics module can create a large number of files, whichfurther degrades the performance of the blob storage.
We highly recommend that you map the folder which stores Web analytics data to the file system of the server. See Mapping the Web for instructions.analytics storage folder to the server file system
> Back to the top list
Temporary and cached files
Deleting files from the AzureCache and AzureTemp folders
Applies to: WEB APPS CLOUD SERVICES BLOB STORAGE
If Kentico is connected to the Azure Blob Storage, it creates two storage folders, and , in its own file system. TheseAzureCache AzureTempfolders store temporary files and their capacity is limited by default. It can happen that your project depletes the allocated space andconsequently Smart Search stops working or media libraries stop accepting files. This can result in the following error:
If this happens, you can temporarily solve these problems by cleaning the AzureCache and AzureTemp folders. In order to solve the problempermanently, see .Preventing Azure cache folders from bloating
To delete files in and folders:AzureCache AzureTemp
Connect to your project.Web Apps - you can use FTP or Visual Studio, etc.Cloud Services - use remote desktop. In the Azure management portal, open your cloud service on the tab andInstancesclick . Download the remote desktop file, run it and submit remote desktop credentials.Connect
Locate the and folder C:\Resources\Directory\<GUID>.CMSApp.AzureCache C:\Resources\Directory\ .CMSApp.AzureTemp <GUID>s and clean the temporary files from them.
Increasing the size of AzureCache and AzureTemp folders
Applies to: CLOUD SERVICES
To increase the size of these folders:
Open your Azure project in Visual Studio.Double-click the role in folder.CMSApp CMSAzure\RolesSwitch to the tab.Local Storage
On this tab, you can set the size of these folders in Megabytes.The option defines if the folder should be emptied when the web role is re-imiged form the Clean on role recycledeployment package (can happen automatically after updates).
You can also set the size of these folders in the ServiceDefinition.csdef file:
<LocalResources> <LocalStorage name="AzureTemp" cleanOnRoleRecycle="true" sizeInMB="100000"/> <LocalStorage name="AzureCache" cleanOnRoleRecycle="false" sizeInMB="100000"/></LocalResources>
You can find details about the allocated resources for web roles in the following article: (sVirtual Machine and Cloud Service Sizes for Azureection ). The local resource disk for the default Small web role instance is 224 GB large. Sizes for Web and Worker Role Instances
Preventing Azure cache folders from bloating
Applies to: WEB APPS CLOUD SERVICES BLOB STORAGE
"There is not enough space on the disk."
1. 2.
1. 2. 3.
4.
1. 2.
3.
See for more recommendations on how to keep these folders from getting full.Preventing Azure cache folders from bloating
> Back to the top list
Smart Search
You can find some tips on using the Smart search functionality on Azure in .Troubleshooting Smart search on Azure
Configuring Azure CDNA Content Delivery Network (CDN) can improve the performance of your websites running in the Azure environment. By replicating thecontents of your Blob storage across multiple data centers around the world, Azure CDN can speed up delivery of static content, such asimages or stylesheets, as well as streaming media. See for details.Using CDN for Azure
You can utilize an Azure CDN service for Kentico projects configured to use and for Kentico Azure projects running inAzure Blob storageCloud Services. To start using a CDN for your project, you need to:
Create a CDN service on the Azure Management Portal.Enable the CDN in Kentico.
Creating a new Azure CDN
Open the .Azure Management PortalClick in the bottom panel and select .New App services -> CDN -> Quick createSelect the storage that is associated with your project as the Origin domain.
Click .Create
The system creates a new CDN. When the CDN is created, note down its CDN endpoint URL.
Configuring Kentico to use a CDN
After you create a CDN using the management portal, you need to register the CDN in your Kentico project to start using this service.
Open the file of your local project.web.configAdd the and keys into the web.config file:CMSAzurePublicContainer CMSAzureCDNEndpoint
<appSettings> <add key="CMSAzurePublicContainer" value="true" /> <add key="CMSAzureCDNEndpoint" value="EndpointURL" /></appSettings>
Replace with the value from your created CDN – in the Azure Management Portal, open your CDN service, locate theEndpointURL
Note that it may take up to 60 minutes for the service to propagate through the CDN network. You may receive error code 400(Bad Request) during this time.
3.
1.
2.
3.
1. 2. 3.
URL and copy it as a value for the CMSAureCDNEndpoint key.CDN Endpoint
Your project is now ready to use the created Azure CDN service. If your site is running on Azure, a full redeployment of your project to theAzure platform is necessary.
Azure CDN content caching
The expiration interval for Azure CDN cache can be defined by the following values:
By web.config key. CMSAzureCDNCacheMinutesSee .Reference - Web.config application keys
By setting in . Cache files (minutes) Settings -> System -> PerformanceSee .Settings - Performance
By the default value defined by Azure. See Azure documentation .How to Manage Expiration of Blob Content in the Azure Content Delivery Network (CDN)
This list is ordered by priority, which means that the default Azure value can be overwritten by configuring the Cache files (minutes) key. Andthis setting can be overwritten by the web.config key.CMSAzureCDNCacheMinutes
If you set the setting and the web.config key to 0 or an invalid value, the default Azure CDN value will be used.
Mapping the Web analytics storage folder to the server file systemIf your project is connected to the (Azure projects deployed to Cloud Services by default and other projects using the Azure Blob Storage <a
web.config key), then the system also stores on the blob storage.dd key="CMSExternalStorageName" value="azure" /> web analytics logsThe Web analytics module writes and processes logs every minute, which can cause problems on the blob storage with latencies. Moreover,the Web analytics module can create a large number of files, which further degrades the performance of the blob storage.
We highly recommend that you map the folder which stores Web analytics data to the file system of the server:
Open your project in Visual Studio.Create a new class in the folder or on web application projects.App_Code CMSApp_AppCode -> Old_App_CodeUse the following code to map the Web analytics storage to the local file system (in ). See ~/App_Data/CMSModules/WebAnalytics S
for further explanations.toring files in different containers
3.
4. 5.
1.
2.
using CMS.IO;using CMS.Base;
[CustomStorage]public partial class CMSModuleLoader{ private class CustomStorageAttribute : CMSLoaderAttribute { /// <summary> /// The system executes the Init method of the CMSModuleLoader attributeswhen the application starts. /// </summary> public override void Init() { // Creates a new StorageProvider instance with the default Windowsfile system provider AbstractStorageProvider webAnalyticsProvider = newStorageProvider();
// Maps a directory to the provider StorageHelper.MapStoragePath("~/App_Data/CMSModules/WebAnalytics",webAnalyticsProvider); } }}
Save the file. If your project is installed in the web application format, rebuild the solution.If your project is deployed to Azure, re-deploy your project.
The Web analytics module now stores its log in the server's file system instead of the blob storage.
Preventing Azure cache folders from bloatingKentico projects connected to the Azure Blob Storage (Cloud Services by default, Web Apps optionally and standard applications connectedto the blob storage) cache temporary data from the blob storage in the file system. The temporary data is stored in the and Azure Temp Azu
folders located in your web application's local file system.re Cache
When these folders contain too much data, your web application's local storage can get bloated and lack free storage for new data. Thesystem can also display errors for not having enough space on the disk.
We recommend the following measures to prevent these folders from containing too much data:
Configuring a CDN for your storageUsing direct links to filesStructuring media library files into foldersConfiguring the Clean Azure storage cache scheduled task
Using direct links to files
When linking to files located on the blob storage, we recommend using (for example, direct links /site/media/imagelibrary/picture.png)instead of links through the application (beginning with ...). Direct access to files reduces the number of files /CMSPages/GetAzureFile.aspxcached in the AzureTemp and AzureCache folders.
To be able to use direct links to files:
Configure the main container on your blob storage to be public – add the following setting to your application:
<add key="CMSAzurePublicContainer" value="true" />
Make sure that the option in application is not selected.Use permanent URLs Settings -> Content -> Media
The system can now use direct links to files on the blob storage.
1. 2.
3. 4.
5.
Structuring media library files into folders
Structure the files in your media libraries into folders of up to 100 files. See fMedia library limitations when storing files in an external storageor details.
Configuring the Clean Azure storage cache scheduled task
To prevent the Azure Temp and Azure Cache folders from bloating, Kentico uses the . TheClean Azure storage cache scheduled taskscheduled task browses through the folders and if a threshold is exceeded, the system deletes the configured amount of files starting fromthe oldest files.
You can set:
The frequency of evaluation of the parameters ( )thresholdThe threshold when the system starts deleting old filesHow many gigabytes of data stay in the system after the deleting occursExcluded paths that are never deleted
Modifying the scheduled task
You can modify the frequency of evaluating the parameters in the application.Scheduled tasks
Open the application.Scheduled tasksLeave in the drop-down list.(global) Site
( ) the scheduled task.Edit Clean Azure storage cacheModify the or other according to your needs.Period properties of the task
The scheduled task uses the class.CMS.AzureStorage.AzureStorageCacheCleanerClick .Save
The scheduled task now runs according to your changes.
Modifying related web.config keys
Set the to affect the process of cleaning the Azure Temp and Azure Cache folders.web.config file
CMSAzureStorageCacheCleanerThreshold
This web.config key specifies a threshold in gigabytes. When the threshold is exceeded, the system starts to delete files from the oldest tothe newest until the result target size is achieved (specified by the web.config key) whileCMSAzureStorageCacheCleanerKeepLimitexcluding the specified paths (set by the web.config key).CMSAzureStorageCacheCleanerExcludedPaths
The default value, i.e., if the key is not specified, is 45GB.
Use the following syntax to add the web.config key:
<add key="CMSAzureStorageCacheCleanerThreshold" value="45"/>
CMSAzureStorageCacheCleanerKeepLimit
This web.config key specifies an amount in gigabytes. The amount is the target size of the Azure Cache and Azure Temp folders when thescheduled task deletes the files. For example, if the amount is set to 10GB, the Azure Cache and Azure Temp folders have in total the size of10GB, after the scheduled task runs and the threshold is exceeded.
The default value, i.e., if the key is not specified, is 10GB. The size of the excluded paths (set by the CMSAzureStorageCacheCleanerExcludedPaths web.config key) is included in the amount.
Use the following syntax to add the web.config key:
<add key="CMSAzureStorageCacheCleanerKeepLimit" value="10"/>
CMSAzureStorageCacheCleanerExcludedPaths
Note: Automatic resizing of images does not work when using direct links to files on a blob storage.
1. 2. 3. 4. 5.
This web.config key specifies relative paths separated by semicolons ( ). The system does not delete files inside the paths typed in the;web.config key .in both the AzureTemp and AzureCache folders
There is not any predefined excluded path by default.
Use the following syntax to add the web.config key (the system does not delete the , , AzureTemp/folder_name1 AzureTemp/folder_name2 Az and folders):ureCache/folder_name1 AzureCache/folder_name2
<add key="CMSAzureStorageCacheCleanerExcludedPaths"value="folder_name1;folder_name2"/>
Recommendations on using Azure SQL Database tiersMicrosoft Azure provides three service tiers for their Azure SQL Databases (Basic, Standard and Premium) according to the provideddatabase size and responsiveness. Each tier is further divided into performance levels, see Azure SQL Database Service Tiers and
for details.Performance Levels
The following table provides our recommendations for running Kentico databases in Azure SQL.
Project demands Azure SQL levels Notes
Projects in development S0 The lowest Standard level is suitable onlyfor projects that are not in production andhave only small performance demands.
Even though Kentico is able to run in the Ba tier, we do not recommend using this tiersic
as it applies strict limitations on maxconcurrent requests and DTUs.
Read-only projects in production S2 Only for small Kentico projects.
Larger read/write projects in production S3 / P1 Large websites with lots of visitors anddatabase requests.
We also recommend that you perform load test when switching to new Azure SQL tier to make sure the database provides satisfactoryperformance. Choosing performance levels that do not cover your project demands can cause slow database response times and generallylow performance.
You can switch between the and on the Select your database tab.Service tiers Performance levels Azure Management Portal -> -> Scale
Storing cache and session state data in Azure environmentIf you want your Azure Cloud Services or Azure Web App application to use two or more instances (processes dedicated to a Web App orweb roles in a Cloud Service), you must configure where the application will store session state information. Session state must be storedeither in the database, which is shared among the servers, or in a special service. Session state cannot be stored in the server's memory,because the session would be lost if the web farm switched requests to another instance.
Storing session state information in the Azure environment:
In Microsoft Azure SQL Database - easy to set up, suitable for small projects or projects with read access to web pages.In Microsoft Azure Cache Service - create the Azure Cache Service and configure it to store session state information.
Storing session state information in Azure SQL Database
Open your Azure project in Visual Studio.Right-click the project and select packages.CMSApp Manage NuGetInstall the package.Microsoft ASP.NET Universal ProvidersOpen the file.web.configFollow the instructions in the code comments of the section.sessionState
After this, your project is configured to store session state information in the Microsoft Azure SQL Database.
Storing session state information in Azure Cache Service
Previously, Microsoft Azure used caching for synchronizing data and storing session state information. This solution is no longerAppFabric supported. Instead, we recommend that you use the .Microsoft Azure Cache Service
Follow the instruction in How to Use Azure Managed Cache Service on MSDN to create and configure a new cache. Continue to How To:Store ASP.NET Session State in the Cache to configure your project to store session state information in the cache.
Troubleshooting Smart search on AzureThis page provides guidance for troubleshooting issues related to the Smart search feature when running Kentico application on Azure.Please note that each section applies either to Web Apps, Cloud Services or both, as specified.
Smart search indexes are not being rebuilt or there are hanging task in the system
If the Smart search correctly or if many Smart search in the system, there is probably a conflictindexes are not being built tasks are stuckbetween the Smart search files located in the file system of the application and files located on the blob storage. When an application ismapped to the blob storage, files in the file system cannot be modified. Therefore, the system is not able to delete the old search indexes.
Please proceed to the section which corresponds to your Azure environment.
Cloud Services - removing Smart search files
Applies to: CLOUD SERVICES
Solution
The solution for this issue on Cloud Services is to delete all files in the folder. Connect to your~/App_Data/CMSModules/SmartSearchservice through remote desktop and delete the files remotely in the file system.
Prevention
We recommend deleting the files in the folder every time before you deploy your application to Cloud~/App_Data/CMSModules/SmartSearchServices.
Web Apps - removing Smart search files
Applies to: WEB APPS
Solution
Immediate solution for this issue on Web Apps is to delete all files in the folder. You can connect to~/App_Data/CMSModules/SmartSearchyour Web Apps service through FTP and delete the files in the file system.
Prevention
However, we recommend a different approach. Azure Web Apps do not require to be connected to the blob storage - connecting a blobstorage is optional. Therefore, to avoid several problems together, we recommend that you map only the media library folders to the blobstorage and leave all other files in the file system of the application.
To map only the media library folder to the blob storage, see .Configuring Kentico to store only media files on Azure storage
However, if you want to connect the blob storage using the web.config key, which maps the whole file systemCMSExternalStorageNameof the application to the blob storage:
You need to delete all Smart search files in the application file system (as described in this section).
Deleting .lock files
Applies to: WEB APPS CLOUD SERVICES
If Smart search functionality is not working properly, you might try deleting files with the extension on the blob storage. .lock Connect to yourblob storage (for example through ) and manually delete them.Cloudberry for Azure
Explanation
A blob storage is shared between all instances of Kentico. If your Azure environment (Cloud Services or Web Apps) operates in multipleinstances, it is important to prevent collisions. Therefore, to prevent multiple instances from manipulating the same index at the same time,
1. a. b. c. d.
2. a. b. c.
3.
Kentico uses the concept of the index for exclusive write. Every time the Smart search needs to manipulate some search index, it lockingcreates a special file with the extension. This file indicates that some search indexer is working with the index. When the work is done,.lockthe system deletes the file from the storage.
There are two different lock files in the blob storage:
searchtaskindexer.lock - located directory.in ~/App_Data/CMSModules/SmartSearchwrite.lock - located in the directory of some particular search index.
In some occasions, these lock files may not get deleted. This may happen when the process that works on the search index endsunexpectedly. When this happens, Smart search is going to be stuck. The solution is to manually delete the lock files.
SmartSearchWorker role troubleshooting on Cloud Services
Applies to: CLOUD SERVICES
The SmartSearchWorker role is part of our Kentico Azure project that is designed to be used on Azure Cloud Services. If you are not runningthe Cloud Services or not using the SmartSearchWorker role, this section does not apply to your environment.
When you are convinced that every setting and every configuration is correct and the worker role runs correctly but it is still not processingthe search tasks, you can look for an error in:
the Kentico Event logSmart search log in App_Data/CMSModules/SmartSearch/workerlog.txt
If you do not find anything related in the event log, try the following troubleshooting practice:
Make sure that remote desktop is configured for your worker role. You can do that in the .Azure Management PortalSelect your Cloud Service.Switch to the tab.ConfigureClick in the bottom panel.Remote
Connect to the worker role through the remote desktop access.Switch to the tab.InstancesSelect the worker role instance.Click in the bottom panel.Connect
Look into the Windows event log using . Try looking for errors from around the time the worker role was starting.Event viewer
Next steps can differ based on the error you find. But the error should provide you with enough information to start with.