App Services Deployment
This section covers various methods and best practices for deploying your applications to Azure App Services.
Deploying with Git
Azure App Services integrates seamlessly with Git repositories, allowing for continuous deployment directly from your source code.
Local Git Deployment
You can set up your App Service to deploy from a local Git repository. Azure provides a Git endpoint for your App Service.
- Navigate to your App Service in the Azure portal.
- Under Deployment Center, select Local Git.
- Follow the instructions to set up your Git credentials and repository.
GitHub/Azure DevOps Integration
Connect your App Service directly to your GitHub or Azure DevOps repository for automated deployments on code commits.
Steps:
- In the Deployment Center, choose GitHub or Azure DevOps.
- Authorize Azure to access your repository.
- Configure your build and deployment settings.
Zip Push Deployment
This method allows you to deploy your application by zipping your project files and pushing them directly to the App Service. This is useful for one-off deployments or when you don't want to set up a Git repository.
Using Azure CLI
You can use the Azure CLI to zip and deploy your application:
az webapp deploy --resource-group MyResourceGroup --name MyWebApp --src-path /path/to/your/app.zip --type zip
Using Zip File Upload in Portal
Alternatively, you can upload a zip file directly through the Azure portal:
- Go to your App Service in the Azure portal.
- Navigate to Deployment Center.
- Select Local Git and then choose the Zip Push Deploy option.
- Upload your zip file.
Container Deployment
Azure App Services supports deploying applications packaged as Docker containers. This provides a consistent environment across development, testing, and production.
Deploying from Docker Hub or Other Registries
Configure your App Service to pull images from public or private Docker registries.
- In the Azure portal, go to your App Service.
- Under Deployment, select Container settings.
- Choose your container registry (Docker Hub, Azure Container Registry, etc.).
- Provide the image name and tag.
- Configure optional settings like port mapping and environment variables.
Azure Container Registry (ACR)
For private images, Azure Container Registry is the recommended solution. It integrates seamlessly with App Services.
Build and Deploy from Source Code (using Dockerfile)
You can also configure App Services to build your Docker image directly from your source code and a Dockerfile.
# Example Dockerfile
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
WORKDIR /app
COPY . .
RUN dotnet restore
RUN dotnet build --no-restore -c Release -o /app/build
FROM build AS publish
RUN dotnet publish --no-build -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "YourApp.dll"]
CI/CD Integration
Automate your build and deployment pipeline using popular CI/CD tools to ensure faster, more reliable releases.
Azure Pipelines
Azure Pipelines offers a robust CI/CD solution that integrates perfectly with Azure App Services.
Key Features:
- Automated builds upon code commit.
- Automated deployments to staging and production slots.
- Integration with various repositories (GitHub, Azure Repos, Bitbucket).
- Release gates and approvals for controlled deployments.

GitHub Actions
Leverage GitHub Actions to create custom workflows that trigger deployments to Azure App Services directly from your GitHub repository.
Example Workflow Snippet:
name: Deploy to Azure App Service
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
- name: Build with dotnet
run: dotnet build --configuration Release
- name: Publish with dotnet
run: dotnet publish --configuration Release --output ./publish
- name: 'Deploy to Azure Web App'
uses: azure/webapps-deploy@v2
with:
app-name: 'MyWebApp'
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
package: './publish'
Other CI/CD Tools
App Services also supports integration with other popular CI/CD tools like Jenkins, Travis CI, and CircleCI.