0% found this document useful (0 votes)
72 views8 pages

Iliou - TP1

Uploaded by

idcentun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views8 pages

Iliou - TP1

Uploaded by

idcentun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Prepare cloud shell for later use

Login to the Azure Portal (https://portal.azure.com) using the below


credentials:

Username [email protected]

Password g!DpeAG40@

In the toolbar at the top of the Azure portal, select the Cloud Shell
icon.
In the Welcome to Azure Cloud Shell dialog, select BASH.

On the you have no storage mounted screen select Show advanced


settings.
In the advanced settings screen, fill in the following fields, then click
Create Storage:

Resource group A Resource Group that is not NetworkWatcherRG

Storage account (Create new) cloudshell41288821

File share (create new) shellstorage


If you receive a "Tenant User Over Quota" error, change your Cloud
Shell Region to an alternative region.

After the cloud shell initializes and puts you at a text prompt, exit
the shell.

In this exercise, you create an Azure virtual machine (VM) and install
Nginx, a popular web server.

You could use the Azure portal, the Azure CLI, Azure PowerShell, or
an Azure Resource Manager (ARM) template.

In this instance, you're going to use the Azure CLI.


Task 1: Create a Linux virtual machine and install Nginx

Use the following Azure CLI commands to create a Linux VM and


install Nginx. After your VM is created, you'll use the Custom Script
Extension to install Nginx. The Custom Script Extension is an easy
way to download and run scripts on your Azure VMs. It's just one of
the many ways you can configure the system after your VM is up
and running.

From Cloud Shell, run the following az vm create command to


create a Linux VM:

azurecli

az vm create \

--resource-group myRGKV-lod41288821 \

--name my-VM-41288821 \

--image Ubuntu2204 \

--admin-username azureuser \

--generate-ssh-keys

Your VM will take a few moments to come up. You name the VM
my-VM-41288821. You use this name to refer to the VM in later
steps.
Run the following az vm extension set command to configure Nginx
on your VM:

azurecli

az vm extension set \

--resource-group myRGKV-lod41288821 \

--vm-name my-VM-41288821 \

--name customScript \

--publisher Microsoft.Azure.Extensions \

--version 2.1 \

--settings
'{"fileUris":["https://raw.githubusercontent.com/MicrosoftDocs/msle
arn-welcome-to-azure/master/configure-nginx.sh"]}' \

--protected-settings '{"commandToExecute": "./configure-


nginx.sh"}'
This command uses the Custom Script Extension to run a Bash script
on your VM. The script is stored on GitHub. While the command
runs, you can choose to examine the Bash script from a separate
browser tab. To summarize, the script:

Runs apt-get update to download the latest package information


from the internet. This step helps ensure that the next command
can locate the latest version of the Nginx package.

Installs Nginx.

Sets the home page, /var/www/html/index.html, to print a welcome


message that includes your VM's host name.

Continue
That's all for this exercise. The sandbox will keep running, and you'll
come back to this point in a few units to update the network
configuration so you can get to the website.

You might also like