top of page

Azure Virtual Machines

Cloud CPU

In this blog:

This lab is important for foundational Azure knowledge, and tackling advanced labs.

Configuring our virtual machine

Sign in with the credentials provided in the lab.

Search for virtual machines in the search bar, and click create.

Configure the machine as shown in the screen shot below.

Keep Availability as No infrastructure redundancy required.

The image can be found in the shared section in all images.

Basic Virtual Machine configuration.
Basic Virtual Machine configuration.
Setting authentication type (SSH)
Setting authentication type (SSH)

Then use the following configuration. Click review and create, and then download the key from the pop up window after the creation process.

Networking tab.
Networking tab.

Identity and Access Management (IAM)

Once deployed, go to the resource, and go to the identity section. Click ON, and save.

Adding system assigned identity.
Adding system assigned identity.

Next, go to the metrolioassets4fe3 storage account, go to the IAM section and add a new role assignment. Click storage blob data reader for the role and go to the members section.

vAdding Storage Blob Data Reader role to Virtual Machine.
Adding Storage Blob Data Reader role to Virtual Machine.

In the members section, click managed identity and select the virtual machine we made before. Then click review and assign.

Adding role assignments.
Adding role assignments.

Connecting via SSH

Now we can connect to the VM using SSH.

Open the terminal in the lab desktop and navigate to where we downloaded the SSH key.

Type this command to modify the SSH keys permissions so it's usable ➡️

chmod 400 metrolio-app-dev_key.pem
Command line.
Making the SSH key permissions usable.

The next command will let us connect to our virtual machine ➡️

ssh -i metrolio-app-dev_key.pem metrolio@20.0.233.30
Command line.
Connecting to the virtual machine with SSH.

Target our storage account and return Blob

Nano into the file inside the user’s home directory, and substitute your storage account name, as shown below.

Command line.
Opening the file with nano.

Use Python3 to run the script to download the blob from the storage account. Here is the blob.

Command line.
Opening the file to find the blob string.

Azure Bastion

Go back to the VM resource page, and stop the virtual machine so that its in a deallocated state.


Go back to the metrolio-test VM, and click on the Bastion in the resource menu.


Sign into the Bastion using the username that you set up for your virtual machine, using the SSH Private Key from Local File authentication method and the id_rsa private key found in your lab desktop’s home folder. Once inside, type LS and find the token.


And that’s It! We're done 👍

Thanks for reading!



Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
  • GitHub
  • Twitter
  • LinkedIn
bottom of page