Deployiong a Node Js app on Azure Cloud

Recently, I decided to explore Azure Cloud and its wide range of services. One of the first things I wanted to try was deploying a Node.js (Express) application on the cloud. I will be using the Azure CLI on Windows. You can also use the Azure portal manually, but I personally find that the CLI offers more detailed control over application deployment and is more developer-friendly.

Let me lay down the steps to below to get started on this, which is quite straigh forward:

  1. Crete an Azure account

You can link your gmail/github whih will be quite easy and dev friendly.

  1. Get the free subscription for 30 days where Microsoft will grant you free credits to play around. No upfront charges are required just a Debit card is ncessary.

  2.  npx express-generator myExpressApp --view ejs
    

    Set up express ap via express-generator

  3. Modify the code of app.js

    1.  winget install --exact --id Microsoft.AzureCLI
      

      Install the Azure cli using Powershell from windows

    2.  az login
      

      Login to your azure account via this command

    3.  az account show
      

      This shows your active subscription

    4. Go to the directory of the express app you created and open up the path in vs code terminal/powershell

    5.  az webapp up --sku F1 --name node-azure-one --os-type Windows
      

      Run this command; node-azure-one is the name of the resource group you’ll be prompted..os type should be windows. You can come up with any name

    6. Once done it sould give the details of the uploaded url and status something like this below:

  1. Test the url endpoints:

  1. Once satisfied you can delete the resource group list from cli/from the Azure portal under you account resource group.

  2. az group delete --name <resource-group-name>
    

    This will help delete the resource group via cli.

In this way deploying a Node js app on the azure cloud becomes easy and feasible by making use of the Azure cli. In my future blogs i shall be covering up more of azure cloud’s services and also deploying and using a full stack mern application.

0
Subscribe to my newsletter

Read articles from Pratikshit Chowdhury directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Pratikshit Chowdhury
Pratikshit Chowdhury