
100 Days of Cloud (Azure Edition)
Day 23 of Cloud (Azure Edition)
AZURE
Nyan
12/16/2025
Day 23: Automating User Data Configuration Using the CLI
Task: The Nautilus DevOps Team is working on setting up a new virtual machine (VM) to host a web server for a critical application. The team lead has requested you to create an Azure VM that will serve as a web server using Nginx. This VM will be part of the initial infrastructure setup for the Nautilus project. Ensuring that the server is correctly configured and accessible from the internet is crucial for the upcoming deployment phase.
As a member of the Nautilus DevOps Team, your task is to create a VM using Azure CLI with the following specifications:
Instance Name: The VM must be named datacenter-vm.
Image: Use any available Ubuntu image to create this VM.
Custom Script Extension/User Data: Configure the VM to run a custom script during its launch. This script should:
Install the Nginx package.
Start the Nginx service.
Network Security Group (NSG): Ensure that the VM allows HTTP traffic on port 80 from the internet.
Instructions:
Use Azure CLI commands to set up the VM in the specified configuration.
Ensure the VM is accessible from the internet on port 80.
The Nginx service should be running after setup.
Use the Azure CLI commands to complete the task.
Notes:
Create the resources only in the East US region.
You may use the default resource group or create a new one if needed.
Day 23 of 100 Days of Cloud (Azure Edition) : Solution
Create a custom data text file in the azure jump host by using command as follows:
#!/bin/bash
apt-get update -y
apt-get install -y nginx
systemctl start nginx
systemctl enable nginx


Day 23 of 100 Days of Cloud (Azure Edition) : Cheers


List the resource group to reveal the existing resource group from the azure portal.
az group list



To configure Port 80 Inbound Rule as follows:
az vm open-port \
--resource-group kml_rg_main-5fdeb53f49ad441d \
--name datacenter-vm \
--port 80 \
--priority 100

Use the following command to create the azure VM.
az vm create \
--resource-group kml_rg_main-5fdeb53f49ad441d \
--name datacenter-vm \
--location eastus \
--image Ubuntu2204 \
--size Standard_B1s \
--admin-username azureuser \
--generate-ssh-keys \
--storage-sku StandardSSD_LRS \
--os-disk-size-gb 30 \
--custom-data cloud-init.txt \
--public-ip-sku Standard