Continuous Deployment to Azure App Service
This tutorial shows you how to configure a continuous deployment workflow for your Azure App Service app. 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.
To enable continuous deployment,
- 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.
In your app's menu blade in the Azure portal, click APP DEPLOYMENT > Deployment options. Click Choose Source, then select the deployment source.
To configure a VSTS account for App Service deployment please see this tutorial.
- Complete the authorization workflow.
In the Deployment source blade, choose the project and branch to deploy from. When you're done, click OK.
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.
- To verify the app is successfully deployed, click the URL at the top of the app's blade in the Azure portal.
- 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.
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
.gitignorefile such as the image below or manually add a
.gitignorefile 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.
To disable continuous deployment,
In your app's menu blade in the Azure portal, click APP DEPLOYMENT > Deployment options. Then click Disconnect in the Deployment options blade.
- 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.
- How to investigate common issues with continuous deployment
- How to use PowerShell for Azure
- How to use the Azure Command-Line Tools for Mac and Linux
- Git documentation
- Project Kudu
- Use Azure to automatically generate a CI/CD pipeline to deploy an ASP.NET 4 app
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.