Open In App

How to use Azure Static Web Apps to Deploy an Angular App ?

In this article, we will learn how to deploy Angular applications using Azure Static Web Apps.

Microsoft Azure: Microsoft Azure is a public cloud computing platform. It provides a lot of cloud services to access, manage, and deploy applications.



Azure Static Web Apps: Azure Static Web App is one of the services of Microsoft Azure. It automatically builds and deploys full-stack web apps from the code repository to azure.

Deploy Angular app using Azure Static Web Apps:



Requirements:

Step 1: Install Node.js

node --version

node version

Step 2: Install Angular CLI

npm install -g @angular/cli

Angular CLI install

Step 3: Create an Angular App

ng new angular-app
cd angular-app
ng serve

Create angular app

Testing on localhost

Running on localhost

Step 4: Create a GitHub repository to store the angular application

Create GitHub Repository

Step 5: Commit local files to the GitHub repository

git init
git add .
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/<replace with repo>.git
git push -u origin main

Upload to GitHub

Note: Make sure you have installed and authorized it on your PC.

Step 6: Open Microsoft Azure Static Web App

Microsoft Azure Home page

Search static web app

Create Static Web App

Step 7: Create a Static Web App

  1.  Select subscription.
  2.  Create a new or select an existing resource group.
  3.  Enter the name of your application.
  4.  Select plan and region.

Project details

  1.  Select the repository source. In this case, GitHub is a source.
  2.  Sign in with your GitHub account.
  3.  Select the Organization, Repository, and Branch of your Angular app.

Deployment details

  1. Select Angular for Build Presets.
  2. Enter the output location in the following format.
dist/app-name

Build details

Deployment

Step 8: Navigate to the GitHub repository

GitHub Actions

Step 9: Return back to azure

Resource details

Step 10: Explore the URL (output)

Output

Congratulations! we deployed the Angular app using Azure Static Web Apps.

Note: The page displayed in the demo URL is the default page of angular application. It can be replaced with an actual application.


Article Tags :