Blog of Denis VOITURON

for a better .NET world

Deployment in Azure Static Web Apps

Posted on 2024-05-03

There are several ways to create a static website in Azure. You’ll find the documentation here: Azure Static Web Apps.

This service is ideal for low-cost deployment of static applications such as Blazor WebAssemblies projects.

On the other hand, Azure Static Web Apps is primarily a service that automatically builds and deploys complete web applications on Azure from a code repository. Sometimes I like to test my code locally and deploy it manually from my local folder.

This is easily done with the swa

There are 3 steps to follow:

  1. Create an Azure Static Web Apps site from the Azure portal.
  2. Retrieve the publication token from this portal: Overview / Manage deployment token.
  3. Install the swa command.

     npm i -g @azure/static-web-apps-cli
  4. Publish the contents of your local ./dist folder to this space.

     swa deploy --output-location ./dist --env production --deployment-token <DEPLOYMENT_TOKEN>

You cannot publish the current folder (using ./), but you need to publish a specific folder (like ./dist). At the end, you will find a confirmation message like ✔ Project deployed to https://123456789.azurestaticapps.net 🚀



Follow me

Recent posts