Azure App Service Quickstart

Get Started in Less Than 5 Minutes

This quickstart guides you through deploying a simple Node.js web app to Azure App Service using the Azure CLI.

  1. Install the Azure CLI and log in:
    az login
  2. Create a resource group:
    az group create --name quickstart-rg --location eastus
  3. Create an App Service plan:
    az appservice plan create --name quickstart-plan --resource-group quickstart-rg --sku B1 --is-linux
  4. Create a web app:
    az webapp create --resource-group quickstart-rg --plan quickstart-plan --name <unique-app-name> --runtime "NODE|14-lts"
  5. Deploy sample code:
    git clone https://github.com/Azure-Samples/nodejs-docs-hello-world
    cd nodejs-docs-hello-world
    az webapp deployment source config-local-git --name <unique-app-name> --resource-group quickstart-rg
    git remote add azure $(az webapp deployment source show --name <unique-app-name> --resource-group quickstart-rg --query url -o tsv)
    git push azure main
  6. Browse to https://<unique-app-name>.azurewebsites.net and see your running app.

Sample Code

Below is the server.js used in the sample application.

const express = require('express');
const app = express();
const port = process.env.PORT || 3000;

app.get('/', (req, res) => {
  res.send('Hello from Azure App Service!');
});

app.listen(port, () => {
  console.log(`App listening on port ${port}`);
});

Next Steps