Deployment in Azure Static Web Apps
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:
- Create an Azure Static Web Apps site from the Azure portal.
- Retrieve the publication token from this portal:
Overview
/Manage deployment token
. -
Install the
swa
command.npm i -g @azure/static-web-apps-cli
-
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 🚀