Overview
Deploying a Blazor Server app to Azure is straightforward with the right setup. This guide walks through App Service deployment with automated CI/CD.
Prerequisites
Create the App Service
az group create --name MyBlogRG --location eastus
az appservice plan create --name MyBlogPlan --resource-group MyBlogRG --sku B1
az webapp create --name mytechblog --resource-group MyBlogRG --plan MyBlogPlan --runtime "DOTNETCORE:10.0"
GitHub Actions Workflow
Add .github/workflows/deploy.yml to automate deployments on every push to main:
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- run: dotnet publish -c Release -o ./publish
- uses: azure/webapps-deploy@v3
with:
app-name: mytechblog
publish-profile: ${{ secrets.AZURE_PUBLISH_PROFILE }}
package: ./publish
Conclusion
With GitHub Actions and Azure App Service, every push to main automatically deploys your blog. Add a custom domain and SSL for a production-ready setup.