Deploy to Azure using the Azure CLI

In this walkthrough, you will deploy a Node.js application to the Azure cloud using the Azure Command Line Interface (CLI).

Prerequisites

If you don't have an Azure account, sign up today for a free 30 day account with $200 in Azure credits to try out any combination of services.

You'll need Node.js and npm and Git installed locally.

Install the Azure Command Line Interface (CLI) which you will use the CLI to do the following:

  • Create an Azure Website.
  • Set up a deployment pipeline between a local/remote Git repository and the Website.
  • View your application's logs (console.log output).

Tip: If you prefer, you can use Azure Cloud Shell from within VS Code for this tutorial. Install the Azure Account extension which adds Cloud Shell support in the Integrated Terminal.

Install the Azure CLI

The Azure CLI is cross platform and runs on Windows, macOS, as well as many different Linux distributions.

Install the Azure CLI

Log In

Once installed, you can use the az command from your favorite terminal.

Following the instructions, browse to https://aka.ms/devicelogin and paste in the 9 character code. When prompted, use the email address and password you used when creating your Azure account.

$ az login
To sign in, go to https://aka.ms/devicelogin and enter the code BF9BUDLGR to authenticate.

Prerequisite Check

Before we continue, ensure that you have all of the prerequisites properly installed. Type each command and ensure it displays the version you have installed. If your Node.js version is less than 6, please upgrade to the most current LTS ("Long Term Stable") release.

$ node -v
6.10.2

Now check that you have git installed. If not, install it and test again.

$ git --version
git version 2.6.4

I've installed the Azure CLI