Continuous Deployment to Azure App Service

This tutorial shows you how to configure a continuous deployment workflow for your Azure Web Apps. App Service integration with BitBucket, GitHub, and Visual Studio Team Services (VSTS) enables a continuous deployment workflow where Azure pulls in the most recent updates from your project published to one of these services. Continuous deployment is a great option for projects where multiple and frequent contributions are being integrated.

To find out how to configure continuous deployment manually from a cloud repository not listed by the Azure Portal (such as GitLab), see Setting up continuous deployment using manual steps.

Enable continuous deployment

To enable continuous deployment,

  1. Publish your app content to the repository that will be used for continuous deployment.
    For more information on publishing your project to these services, see Create a repo (GitHub), Create a repo (BitBucket), and Get started with VSTS.
  2. In your app's menu blade in the Azure portal, click APP DEPLOYMENT > Deployment options. Click Choose Source, then select the deployment source.

    Note

    To configure a VSTS account for App Service deployment please see this tutorial.

  3. Complete the authorization workflow.
  4. In the Deployment source blade, choose the project and branch to deploy from. When you're done, click OK.

    Note

    When enabling continuous deployment with GitHub or BitBucket, both public and private projects will be displayed.

    App Service creates an association with the selected repository, pulls in the files from the specified branch, and maintains a clone of your repository for your App Service app. When you configure VSTS continuous deployment from the Azure portal, the integration uses the App Service Kudu deployment engine, which already automates build and deployment tasks with every git push. You do not need to separately set up continuous deployment in VSTS. After this process completes, the Deployment options app blade will show an active deployment that indicates deployment has succeeded.

  5. To verify the app is successfully deployed, click the URL at the top of the app's blade in the Azure portal.
  6. To verify that continuous deployment is occurring from the repository of your choice, push a change to the repository. Your app should update to reflect the changes shortly after the push to the repository completes. You can verify that it has pulled in the update in the Deployment options blade of your app.

Continuous deployment of a Visual Studio solution

Pushing a Visual Studio solution to Azure App Service is just as easy as pushing a simple index.html file. The App Service deployment process streamlines all the details, including restoring NuGet dependencies and building the application binaries. You can follow the source control best practices of maintaining code only in your Git repository, and let App Service deployment take care of the rest.

The steps for pushing your Visual Studio solution to App Service are the same as in the previous section, provided that you configure your solution and repository as follows:

  • Use the Visual Studio source control option to generate a .gitignore file such as the image below or manually add a .gitignore file in your repository root with content similar to this .gitignore sample.

  • Add the entire solution's directory tree to your repository, with the .sln file in the repository root.

Once you have set up your repository as described, and configured your app in Azure for continuous publishing from one of the online Git repositories, you can develop your ASP.NET application locally in Visual Studio and continuously deploy your code simply by pushing your changes to your online Git repository.

Disable continuous deployment

To disable continuous deployment,

  1. In your app's menu blade in the Azure portal, click APP DEPLOYMENT > Deployment options. Then click Disconnect in the Deployment options blade.

  2. After answering Yes to the confirmation message, you can return to your app's blade and click APP DEPLOYMENT > Deployment options if you would like to set up publishing from another source.

Additional Resources

Note

If you want to get started with Azure App Service before signing up for an Azure account, go to Try App Service, where you can immediately create a short-lived starter web app in App Service. No credit cards required; no commitments.