1. Create Linux virtual machine with Express.js app using Azure CLI
In this tutorial, create a Linux virtual machine (VM) for an Express.js app. The VM is configured with a cloud-init configuration file and includes NGINX and a GitHub repository for an Express.js app. Once the VM is running, you can connect to the VM with SSH, change the web app to including trace logging, and view the public Express.js server app in a web browser.
This tutorial includes the following tasks:
- Sign in to Azure with Azure CLI
- Create Azure Linux VM resource with Azure CLI
- Open public port 80
- Install demo Express.js web app from a GitHub repository
- Install web app dependencies
- Start web app
- Create Azure Monitoring resource with Azure CLI
- Connect to VM with SSH
- Install Azure SDK client library with npm
- Add Application Insights client library code to create custom tracing
- View web app from browser
/traceroute to generate custom tracing in Application Insights log
- View count of traces collected in log with Azure CLI
- View list of traces with Azure portal
- Remove resources with Azure CLI
Create or use an existing Azure subscription
You'll need an Azure user account with an active subscription. Create one for free.
- SSH to connect to the VM: Use a modern terminal such as bash shell, which includes SSH.
If you prefer to run CLI reference commands locally, install the Azure CLI. If you're running on Windows or macOS, consider running Azure CLI in a Docker container. For more information, see How to run the Azure CLI in a Docker container.
If you're using a local installation, sign in to the Azure CLI by using the az login command. To finish the authentication process, follow the steps displayed in your terminal. For other sign-in options, see Sign in with the Azure CLI.
When you're prompted, install the Azure CLI extension on first use. For more information about extensions, see Use extensions with the Azure CLI.