Configure continuous deployment to Azure App Service

Note

Starting June 1, 2024, newly created App Service apps can generate a unique default host name that uses the naming convention <app-name>-<random-hash>.<region>.chinacloudsites.cn. For example: myapp-ds27dh7271aah175.westus-01.chinacloudsites.cn. Existing app names remain unchanged.

myapp-ds27dh7271aah175.chinanorth3-01.chinacloudsites.cn

You can configure continuous deployment from GitHub, Bitbucket, and Azure repositories by using Azure App Service, which pulls in the latest updates. This guide provides you with everything you need to get started.

Prepare your repository

To get automated builds from Azure App Service build server, make sure that your repository root has the correct files in your project.

Runtime Root directory files
ASP.NET (Windows only) *.sln, *.csproj, or default.aspx
ASP.NET Core *.sln or *.csproj
PHP index.php
Ruby (Linux only) Gemfile
Node.js server.js, app.js, or package.json with a start script
Python *.py, requirements.txt, or runtime.txt
HTML default.htm, default.html, default.asp, index.htm, index.html, or iisstart.htm
WebJobs <job_name>/run.<extension> under App_Data/jobs/continuous for continuous WebJobs, or App_Data/jobs/triggered for triggered WebJobs. For more information, see Kudu WebJobs documentation.

To customize your deployment, include a .deployment file in the repository root. For more information, see Customize deployments and Custom deployment script.

Note

If you develop in Visual Studio, let Visual Studio create a repository for you. The project is immediately ready to be deployed by using Git.

Configure the deployment source

  1. In the Azure portal, go to the management pane for your App Service app.

  2. On the left menu, select Deployment Center. Then select Settings.

  3. In the Source box, select one of the Continuous Deployment (CI/CD) options:

    Screenshot that shows how to choose the deployment source.

To continue, select the tab that corresponds to your build provider.

Disable continuous deployment

  1. In the Azure portal, go to the management page for your App Service app.

  2. On the left menu, select Deployment Center. Then select Settings > Disconnect.

    Screenshot that shows you how to disconnect your cloud folder sync with your App Service app in the Azure portal.

  3. The GitHub Actions workflow file is preserved in your repository by default, but it continues to trigger deployment to your app. To delete the file from your repository, select Delete workflow file.

  4. Select OK.

What are the build providers?

Depending on your deployment source in Deployment Center, you might see a few build provider options. Build providers help you build a continuous integration and continuous delivery (CI/CD) solution with Azure App Service by automating build, test, and deployment.

You're not limited to the build provider options found in Deployment Center, but by using App Service, you can set them up quickly and get some integrated deployment logging experience.

The GitHub Actions build provider is available only for GitHub deployment. When configured from the app's deployment center, the build provider sets up CI/CD by depositing a GitHub Actions workflow file into your GitHub repository that handles build and deploy tasks to App Service.

For basic authentication, it adds the publish profile for your app as a GitHub secret. The workflow file uses this secret to authenticate with App Service. For user-assigned identity, see What does the user-assigned identity option do for GitHub Actions?

It captures information from the workflow run logs and displays it on the Logs tab in Deployment Center.

You can customize the GitHub Actions build provider in the following ways:

  • You can customize the workflow file after it generates in your GitHub repository. For more information, see Workflow syntax for GitHub Actions. Just make sure that the workflow deploys to App Service with the azure/webapps-deploy action.
  • If the selected branch is protected, you can still preview the workflow file without saving the configuration, and then manually add it to your repository. This method doesn't give you log integration with the Azure portal.
  • Instead of using basic authentication or a user-assigned identity, you can also deploy by using a service principal in Microsoft Entra ID. This method can't be configured in the portal.