Deploy an Angular application to Azure App Service

Deploy an Angular application to Azure App Service

Microsoft Azure is a Cloud Computing platform that offers interesting services to host and manage web applications.

What about Angular web application? How do we do this?

There is very little to do for an Angular application that you would have generated with the ng CLI:

  • Create a new file web.config in src folder with the following contents
<?xml version="1.0" encoding="UTF-8"?>
        <rule name="Redirect to https" stopProcessing="true">
          <match url=".*" />
            <add input="{HTTPS}" pattern="off" ignoreCase="true" />
          <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
        <rule name="Angular" stopProcessing="true">
          <match url=".*" />
          <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
          <action type="Rewrite" url="/" />
      <remove fileExtension=".woff" />
      <mimeMap fileExtension=".woff" mimeType="application/font-woff" />
      <remove fileExtension=".woff2" />
      <mimeMap fileExtension=".woff2" mimeType="font/x-woff" />
      <remove fileExtension=".json" />
      <mimeMap fileExtension=".json" mimeType="application/json" />
  • Edit angular.json file and add the lines to include the web.config file
  "$schema": "./node_modules/@angular-devkit/core/src/workspace/workspace-schema.json",
  "version": 1,
  "defaultProject": "app",
  "newProjectRoot": "projects",
  "projects": {
    "app": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "prefix": "app",
      "schematics": {},
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "www",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/",
            "assets": [
                "glob": "**/*",
                "input": "src/assets",
                "output": "assets"
            "styles": [

You can have a try, there is a Azure service plan that is completely free to use!


Leave a Reply

Your email address will not be published. Required fields are marked *