Microsoft developers just added a new resource type called Static Web App, something I was looking for since the day I started using Azure.

It makes a simple way to deploy a web page and a set of APIs based on Azure Functions. By the time of writing, the service is still in beta, and have some caveats.

Simple case

Let's deploy a really simple project, meaning:

First we create a resource on Azure. The master is super-simple, just don't pick GitHub under Deployment details and leave the Source to Other. This way, you won't have to let Azure DevOps app to access your repository.

Wait for resource to be created, then go to the resource page and click on Manage deployment token tab. Copy the token and create a variable in your repository named AWESOME_PAGE_DEPLOYMENT_TOKEN or alike.

Second step is to create deployment workflow using GitHub Actions. Create file .github/workflows/deploy.yml in your repository, with following contents:

name: Awesome page CI/CD on: push: branches: - dev jobs: build_and_deploy_job: runs-on: ubuntu-latest name: publish steps: - uses: actions/checkout@v2 - name: upload id: deploy uses: Azure/static-web-apps-deploy@v0.0.1-preview with: azure_static_web_apps_api_token: ${{ secrets.AWESOME_PAGE_DEPLOYMENT_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }} action: "upload" app_location: "/static" skip_app_build: true

Fix branch name and the path to static files. And basically, that's it. From here you can expand by adding lambda functions, actual build steps etc.

The root domain problem

One really major issue with the service is limited support of custom domains. It is not possible to use root domain at this point, you're forced to implement something like www or blog or whatever. Which could be quite a drawback for some people, especially those who wants to migrate to this service from less sophisticated solutions like using Azure Storage to host static files, and don't want to set up redirection and mess up with their SEO.

An example on how to set up such redirection is explained in details here:
How to configure a root domain in an Azure Static Web App

UPD 2021-05-14 Custom root domains are working!