Azure CLI
4. Creating a Resource Group Using AZ CLI
Overview
This exercise introduces the Azure CLI for managing Azure resources. You will use Azure CLI commands to create a resource group and verify its creation.
Step 1: Log in to Azure Cloud Shell
- Open the Azure Portal and click the Cloud Shell icon (top-right corner).
- Select Bash as your shell environment if prompted.
💡 Information
»
The Azure Cloud Shell is a Terminal in the Azure Portal that comes pre-configured with the Azure CLI. It enables you to run CLI commands without additional setup.
5. Provisioning a VM Using AZ CLI, Configuring Nginx, and Allowing HTTP Traffic
Overview
This exercise introduces creating a Virtual Machine (VM) with Azure CLI, using default SSH keys for secure authentication, installing Nginx, and configuring the network to allow HTTP traffic. You will work exclusively in the VSCode Integrated Terminal (Windows users: Make sure you use Git Bash).
Step 1: Set Up the Environment
Open VSCode and launch the Integrated Terminal:
- On Windows, use Git Bash inside VSCode.
- On Mac or Linux, use the default terminal.
Verify that Azure CLI is installed by running:
»
6. Automating VM Creation, Nginx Installation, and Port Configuration Using a Bash Script
Overview
In this exercise, you will create a Bash script that automates the provisioning of a resource group, a VM, and the opening of port 80. You will also use a custom data file to automatically install and configure Nginx on the VM during provisioning. This exercise enables a “one-click” solution for deploying a web server.
Step 1: Prepare the Custom Data File
Create a file named
»custom_data_nginx.sh(You can use VSCode)