Publish your project to Azure App Services

PREREQUISITES:
  • You must have Visual Studio 2015 Update 3 or later
  • Active Azure account subscription
  • Azure SDK for VS 2015 or later
  • Microsoft Web Deploy
  • Your Sitefinity website instance must be running on local machine. 

Once you have your database deployed in Azure SQL Database, the next step is to have your website files deployed to Azure App Service. The process is facilitated in Visual Studio. Follow these steps:

  1. Open your project in Visual Studio.
  2. Make sure to include in your project's the following folders and files:
    • The AdminApp folder, located in your projects root folder.
    • The Configuration folder, located in ~/App_Data/Sitefinity/Configuration.
    • Your Sitefinity license, located in ~/App_Data/Sitefinity/Sitefinity.lic
    • The ResourcePackages folder, located in your project's root folder.
  3. In the context menu of your project, click Publish.
  4. In the next screen, click the Start button under the Publish section
    Start_button_publish_section
  5. Next, from the wizard screen that opens, make sure to select App Service as a publishing target. If you want to create a new App Service for your website to be deployed to, select Create new.

    NOTE: If you already have an active App Service that you want to use for deploying your website, skip this step and choose the Select Existing option.


    Select_create_new_app_service
  6. Click on OK.

  7. The next step prompts you to login to your Azure account if you are not already logged in. Once you log in, fill in the details for your new App Service:
    1. App Name – provide the desired name for your application. It will be used for identifying your app in the Azure portal
    2. Subscription – select the desired subscription from your available Azure subscriptions
    3. Resource group – choose the desired resource group. Make sure you select the same resource group as the one you specified for your logical SQL server
    4. Hosting Plan – click on New and fill in the following details:
      1. App Service Plan – fill in the desired name of your hosting plan
      2. Location – choose the desired location that best suits your website’s visitors geographic location
      3. Size – the officially recommended minimum size for a Sitefinity website hosting plan is P1.
      4. Click on OK.

      Configure_hosting_plan
    5. Finally, select a region for the Application Insights dropdown. Adding Application Insights to your App Services enables you to monitor your website performance and traffic as well as benefit from advanced performance profiling mechanisms. For more information refer to the What is Application Insights? article form the Microsoft documentation. Review all the information provided on this screen and when finished, click on Create to create your App Service.
      Create_App_Service

  8. Upon successful configuration of your App Service, the Visual Studio Publish screen displays a confirmation message:
    Publish_Success
  9. At this point, do not click Publish yet. You must navigate to the Azure portal and configure your database in your App Service prior to publishing the site.
  10. Navigate to the Azure portal and select from the left-hand navigation (or search for) Resource groups
  11. Find your resource group and verify that your App Service, Application Insights and App Service plan have been added there:
    Find_AppService_plan
  12. Click on your App Service and select Configuration from the navigation menu on the left
    AppService_Configuration
  13. Click New application setting and add following setting:
    1. Name: sf-env:ConnectionStringParams:defaultConnection
    2. Value: data source=tcp:{your_server_name}.database.windows.net,1433;User ID={server admin name};Password={your_password}

    These details define the connection string to your website database. Use the server name, admin user name and password details for your logical SQL server. If you created the logical server as part of the deployment process, refer to the information you provided in the Deploy the database to Azure SQL step.
  14. Click OK and then Save
  15. Back in Visual Studio, edit your website web.config file as follows:
    1. Add the following entries to the <appSettings> section:
      1. <add key="sf-env:ConnectionStringName" value="defaultConnection" />
      2. <add key="sf-env:ConnectionStringParams:defaultConnection" value="" />

      These entries instruct Sitefinity to read the server name and admin user credentials from the App Service application settings. Additionally, the last entry enables configures the Sitefinity Health Check endpoint.

    2. Add a <connectionString> element to instruct Sitefinity how to connect to your Azure SQL Database:

      <connectionStrings>
      <add connectionString="initial catalog={your_azure_db_name};Persist Security Info=False;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;Backend=SqlAzure;" name="defaultConnection" />
       </connectionStrings>

    3. Save the web.config file

  16. Delete the DataConfig.config file from the ~/App_Data/Sitefinity/Configuration folder. This instructs Sitefinity to look for a connection string in the web.config file instead.
  17. Go back to the Publish tab, or right click on your project and choose Publish. On the Publish screen click the Publish button to deploy your project to your Azure App Service.
    Back_to_Publish_tab
  18. Your Sitefinity website should be up and running in a few minutes. Visual Studio automatically opens a new browser tab for the website URL, but you can also manually browse it using the Site URL link on the Visual Studio Publish screen.
    Publish_Success_Site_URL

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Web Security for Sitefinity Administrators

The free standalone Web Security lesson teaches administrators how to protect your websites and Sitefinity instance from external threats. Learn to configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?