Managed Services

WebApp sitecore CD pipeline in Azure

Introduction

1.1   Purpose

The main purpose of this document is to configure a CI/CD pipeline in the Azure.

1.2   Scope

This Document applies to the IT Engineer who wants to configure the Continuous delivery pipeline for Web app in the Azure portal.

1.3       Prerequisite

  1. A work or school account / Microsoft account and a Microsoft Azure subscription with the following Azure services enabled:
  2. Microsoft Visual Studio 2013 / 2015 or higher
  3. Microsoft Azure SDK 2.8.2 for .NET or newer
  4. Microsoft SQL Server Management Studio 2014 or newer
  5. Sitecore® Experience Platform™ 8.0 rev. 160115 (8.0 Update-7) or higher

2.     Configuration:

  1. In the Azure portal, select the “+” icon and create a resource group as shown in the below image.
  2. In the Azure portal, select your web app. If you have not yet created a web app, do this now by choosing the “+” icon, selecting Web App from the Web + Mobile category, and providing a name and a resource group as shown in the below image.

  1. In the Web Appblade, click the All settings button and select the Application settings

4. In the Application settingsblade, configure the following groups and save the changes.

  1. In the General settings group:
      1. Set the PHP version switcher to the Off value.
      2. Set the Platform switcher to the 64-bit value.
      3. Set the Always On switcher to the On value.

    Sitecore CD Azure

    4. [Optional] Set the Remote debugging switcher to the On value and select the Visual Studio version.

    Azure webapp CD sitecore

 

5. After Application settings is configured, we need to update our sitecore databases from local environment to Azure.

6. Now we will create a storage to upload our databases in the Azure, based on your database storage choose your storage in the Azure.

7. Now enter the resource group and click on “+” symbol on the top of the resource group and search for the “Storage” as shown in the below image.

 

8. Select the Storage account and create the storage by providing the necessary details for the storage account as shown in the following image.

Sitecore CD pipeline in Azure9. In the Startboard, click on the storage which we have created earlier as “techsitecore” name.

10. In the Storage account blade, click on the AccessKeys then “Default keys” will be appeared as shown in the below image. The Manage keys blade appears.

11. In the Manage keys blade, copy the Storage account name and Primary access key.

Sitecore CD Pipeline

3.     SQL DB Export to Azure:

If we are using Azure SQL Databases, the following steps need to be done to update the database schema in the Azure environment from the local environment.

  1. In the SQL Server Management Studio, update the Sitecore database schema to fit the Azure SQL Database service requirements:
  2. In the SQL Server Management Studio, in the Object Explorer window, right-click a Sitecore database, and select Tasks -> Export Data-tier Application… in the context menu. The Export data-tier Application dialog box appears.
  3. In the Export data-tier Applicationdialog box, click the Next  button to go to the Export Settings.
  4. In the Export Settingsstep, select the Save to Windows Azure option and click the .. button. The Connect to Windows Azure Storage dialog box appears.
  5. In Connect to Windows Azure Storagedialog box, fill in the Storage account and Access key fields using the copied Storage account name and Primary access key from the Microsoft Azure Portal, then click the Connect
  6. In the Export Settingsstep, fill in the Container field and then click the Next button to go to the Summary
  7. In the Summarystep, click the Finish button to start creating a *.bacpac
  8. In the Resultsstep, click the Close button when the operation is complete.
  9. Now update the remaining databases in the same process of steps 14-18
  10. Now we will create the SQL databases in Azure, Enter into the Resource group and click on + add button and search for the SQL Databases in the search bar of the resource group and select the SQL Database as shown in the below image.
  11. Now provide the necessary details for configuring the SQL database in the Azure portal. As shown in the below image.
  12. After successfully creating of the SQL databases in the resource group. Enter the SQL Database Manager and select the empty database which we have created in the Database Manager as shown in the below image.
  13. Now select the Empty database and delete it. As shown in the above image.
  14. And now on the top of the SQL Database Manager, select the Import database and provide the necessary details for the importing of the database into the SQL Database Manager as shown in the below image.
  15. Now you can see the imported database in the SQL DB Manager as shown in the below image.
  16. Now after importing the all databases form the local to the Azure Portal we need to map the connection strings of the databases with the sitecore solution file. As shown in the following image.                                Note: differentiate connection strings of local and azure
  17. In the Connection strings group, we need to configure the following connection strings with the databases:
  18. Add the core, master and web SQL Database connection strings.
  19. To configure the connection strings, copy the connection string of database form the azure database. As shown in the following image and replace the User ID=Devopsuser and password = password , with the Authentications provided while creating the database server.

                  a. Server=tcp:sitecore80.database.windows.net,1433;Initial Catalog=core;Persist Security                                                                               Info=False;User ID={your_username};Password={your_password};MultipleActiveResultSets=False;                                               Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;

                  b. Server=tcp:sitecore80.database.windows.net,1433;Initial Catalog=web;Persist Security                                                                               Info=False;User ID={your_username};Password={your_password};MultipleActiveResultSets=False;                                                Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;

                   c. Server=tcp:sitecore80.database.windows.net,1433;Initial Catalog=master;Persist Security                                                                        Info=False;User ID={your_username};Password={your_password};MultipleActiveResultSets=False;                                               Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;

20. In order to configure the sitecore CD pipeline we need to have a complete structure of sitecore core files and directories structure in the webapp. To configure the basic sitecore structure we need to configure and install sitecore application in the local machine publish those file structure into the Azure webapp.

 

 

21. To publish from local to Azure webapp we need to download the Publishing profile from Azure webapp as shown in the following image.

22. Right click and select Publish option in the visual studio solution. And import the publishing profile which we have downloaded. As shown in the following image.

23. Once the Publish option is selected, the publishing profile will communicate with the Azure webapp and start uploading the sitecore files, directories into the azure webapp as shown in the following image.

24. In the ASP.NET Web Application project, include the default Sitecore files, directories and subdirectories and publish it to the Azure webapp. We need to have the following structure of the sitecore in the Azure webapp.

      1. For a Content Delivery environment:
  • \App_Browsers
  • \App_Config
  • \App_Data
  • \Areas
  • \bin
  • \Controllers
  • \layouts
  • \Models
  • \sitecore\services
  • \sitecore modules
  • \sitecore_files
  • \temp
  • \upload
  • \Views
  • \xsl
  • \Default.aspx
  • \default.css
  • \default.htm.sitedown
  • \default.js
  • \Global.asax
  • \Web.config
  • \webedit.css
      1. For a Content Managementenvironment, additionally include the following directories and files:
  • \sitecore\admin
  • \sitecore\Copyright
  • \sitecore\debug
  • \sitecore\images
  • \sitecore\login
  • \sitecore\portal
  • \sitecore\samples
  • \sitecore\service
  • \sitecore\shell
  • \sitecore\blocked.aspx
  • \sitecore\default.aspx
  • \sitecore\no.css

 

25. Visual Studio may freeze when including the entire \sitecore\shell directory at once because it contains a lot of files and subdirectories. Try to split all the subdirectories into portions, and then add them one by one.

26. Once the sitecore structure is published to the webapp in Azure.

27. We need to configure it configure the Source code repository in the online team services account and push the same sitecore solution code into the VCS repository.

28. Once the source code is published in VCS repo, choose Continuous Delivery (Preview) and then choose Configure to initiate the CI/CD pipeline.

29. Select Choose repository and select the type of repository where you stored your source code as shown in the below image.

30. Select the project, repository, and branch to deploy from. When you’re done, choose OK.

31. Select Configure Continuous Delivery and choose the web application framework you used to develop your app, ASP.NET and select OK.

 

32. Select Set up load test and decide if you want to run a load test on your app before deploying the latest changes to production. The default is NO. If you want to set up a load test (25 virtual users concurrently accessing the app for 60 seconds), choose YES then specify whether to use an existing Azure App Service instance, or create a new one in a new App Service plan and select OK.

33. Select Configure deployment and decide if you want to deploy your latest changes first to staging, and then promote to production. The default is NO. If you want to set this up, choose YES then specify whether you want to use an existing Azure App Service slot, or create a new one, and select OK.

34. Once done select the continuous delivery pipeline will be created and execute the Delivery Workflow.

About The Author

Leave a Reply

*