Since Azure now has a free service for hosting static web apps (Azure Static Web Apps), I decided to move my Hugo blog to this service. The move to Azure Static Web Apps was quite easy. I mostly followed the tutorial, found two issues and fixed the documentation .

PRs are pending https://github.com/MicrosoftDocs/azure-docs/pull/55606 & https://github.com/MicrosoftDocs/azure-docs/pull/55605.

Move repository and adjust the build process

In the past the repository of my blog was on Azure DevOps, so this moved to Github. I created a new (private) repository and just copied over the files from the previous repository.

Since I need the extended version of Hugo I change the workflow file to use it:

    - name: Setup Hugo
      uses: peaceiris/actions-hugo@v2.4.8
      with:
        hugo-version: "latest"
        extended: true

I also changed the build command so it fits for my repository structure. The source of my blog is not stored in the root folder but in an src folder.

    - name: Build
      run: hugo -s ./src -d ../public

Configure 404 route

The final change to be made was to configure a route to the 404 page. This can be done with the routes.json (thanks @JohnPapa for the hint)

{
    "platformErrorOverrides": [
        {
          "errorType": "NotFound",
          "serve": "/404.html"
        }
      ]
}

After that and a push to GitHub Azure Static Web Apps build the site and published it. Wonderful magic 😊

Summary

Moving an existing static site to Azure Static Web Apps is quite easy and does not need much time! The documentation for the service is quite good and has a lot of examples on how to configure everything!