Leverage the power of Azure App Service to host your web applications and automate deployments using Continuous Integration (CI). This guide outlines the steps to set up a CI pipeline, ensuring your code changes are automatically built, tested, and deployed to your App Service instance.
Azure App Service integrates seamlessly with popular Git providers. You can configure this directly from the Azure portal.
Go to the Azure portal and select your App Service resource.
In the left-hand menu, under "Deployment," click on "Deployment Center."
Select your Git provider (e.g., GitHub, Azure Repos, Bitbucket). You may need to authorize Azure to access your repository.
Select the repository containing your application code and the branch you want to deploy from (e.g., main
or master
).
Once connected, Azure App Service will guide you through configuring the build process. This typically involves specifying the build provider (like Azure Pipelines or GitHub Actions) and build settings.
Azure Pipelines is the default and recommended option for Azure Repos. For GitHub, you can choose GitHub Actions.
Azure will automatically detect your project type and suggest a basic build pipeline configuration. You can customize this YAML file to include specific build steps, unit tests, and deployment tasks.
For example, a simple Azure Pipelines YAML for a Node.js app might look like this:
trigger:
- main
pool:
vmImage: 'ubuntu-latest'
steps:
- task: NodeTool@0
inputs:
versionSpec: '16.x'
displayName: 'Install Node.js'
- script: |
npm install
npm run build
displayName: 'npm install and build'
- task: AzureWebApp@1
inputs:
azureSubscription: ''
appType: 'webAppLinux'
appName: ''
package: '$(System.DefaultWorkingDirectory)/build'
displayName: 'Deploy to Azure App Service'
For GitHub Actions, the YAML would be placed in .github/workflows/
.
After configuring your build pipeline, save the changes. Azure App Service will automatically trigger a build and deployment on the next commit to your selected branch.
You can monitor the status of your builds and deployments in the "Deployment Center" or directly within Azure Pipelines/GitHub Actions.
By implementing continuous integration, you streamline your development workflow and ensure your applications are always up-to-date and robust on Azure App Service.