Create the Website

In this step, you will use the Azure CLI to create a website on Azure.

Tip: The Azure CLI extension for VS Code provides syntax colorization, IntelliSense (completions) and snippets when writing Azure CLI scripts

Install the Azure CLI extension

Create a Resource Group

A Resource Group is essentially a named collection of all our application's resources in Azure. For example, a Resource Group can contain a reference to a website, a database, and an Azure function.

$ az group create --name myResourceGroup --location westus

Here we created a Resource Group called myResourceGroup and we are telling Azure to store the Resource Group metadata (the list of resources in the group) in the westus data center.

Next, let's tell the Azure CLI to use this newly created Resource Group as the default group in any subsequent commands so we don't have to type it in each time. While we're at it, we'll tell the CLI that we want everything stored in the westus data center too.

$ az configure --defaults group=myResourceGroup location=westus

Create an App Service Plan

An App Service Plan defines the physical resources that will be used to host our website. In this walkthrough, we will use a Free hosting plan (--sku F1) which means our site will be hosted on a machine alongside other websites. You can scale up and be the only site running on a machine by specifying a different value for --sku.

$ az appservice plan create --name myPlan --sku F1

Create the website

Now create the website. Make sure to give it a unique name as it will be referenced as In this example, we'll call it myExpressApp-chrisdias.

$ az webapp create --name myExpressApp-chrisdias --plan myPlan --runtime "node|6.9"

# In PowerShell, the command requires the --% operator
PS> az --% webapp create --name myExpressApp-chrisdias --plan myPlan --runtime "node|6.9"

Notice the --runtime "node|6.9" parameter at the end of the command. This tells Azure to use node version 6.9.x when running this application. You can also state the desired node version in your package.json. During deployment Azure will recognize this and attempt to use that version instead.

For example, the following package.json entry will tell Azure this application requires at least node 7.0.0 to run.

"engines": {
  "node": ">7.0.0"

Run the website

Finally, let's ensure the site is up and running.

$ az webapp browse --name myExpressApp-chrisdias

You should see something like this:

Empty Azure Website

My site is running