Monday, 9 March 2026

Deploy Angular/React Application to Azure Static Web App from Visual Studio Code

Step 1: Build your React project

Open the terminal in VS Code and run:

npm install
npm run build

Step 2: Get Deployment Token

  • Go to Microsoft Azure Portal.
  • Open your Azure Static Web App
  • Click Deployment Token
  • Copy the token

Step 3: Install Azure Static Web Apps CLI

Install the CLI tool:

npm install -g @azure/static-web-apps-cli

This installs SWA CLI.

Step 3: Deploy the build folder

Run this command inside your project folder.

swa deploy ./dist --deployment-token ABC123XYZ

Your URL changed because the deployment was created as a preview environment instead of production.

 If you want to deploy on a real URL, then run the command.

swa deploy ./dist --deployment-token TokenHere --env production

Your site will be available at:

https://your-app-name.azurestaticapps.net

No comments:

Post a Comment

404 when you refresh React Page on Static Web App

This happens because React uses client-side routing, while Azure Static Web Apps serves static files. When you refresh /login, Azure tries t...