> For the complete documentation index, see [llms.txt](https://kingsabri-2.gitbook.io/pwining-aws-and-asure/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kingsabri-2.gitbook.io/pwining-aws-and-asure/getting-started-with-azure/setup/getting-started-with-azure-portal.md).

# Getting Started with Azure Portal

The best way to learn about the navigating the Azure Portal is by trying it to solve something for us.

As an example and to get familiar with the Azure Portal, let's create a Ubuntu based Virtual Machine

## Create a Resource Group

From the burger menu, select `Resource Groups` and create a new resource group. You can also use the same resource group that you created in the previous chapter for Azure Cloud shell.

All the services we use can be made to operate within a resource group. This makes it easier to delete the objects all at once instead of independently removing them.

## Creating an Ubuntu based Virtual Machine

Creating a new virtual machine in Azure Portal is all about doing the following

* Choose the base operating system for the virtual machine (VM)
* Choose under which resource group will the VM run
* Fill in the values
  * for region where the VM should spin up
  * select a VM size
  * add a user and SSH key for access
  * open a port to allow SSH access
* Once the VM is created, use the provided information to login

The first step is to start by clicking on resource groups

**In this example, Resource Group name is `bapazure`. Please use the Resource Group name that you have created.**

![Click on our resource](https://441555962-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M4co4Py2DyRvsKhKa-u%2F-M4dKiFJor0gJgjeW_pX%2F-M4dKpXiVJ-q4G77u_Qo%2Fazure-portal-basic-vm-2.png?generation=1586610276116423\&alt=media)

Click on add and type `Ubuntu Server 18.04 LTS`

![Add and filter for Ubuntu Server 18.04 LTS](https://441555962-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M4co4Py2DyRvsKhKa-u%2F-M4dKiFJor0gJgjeW_pX%2F-M4dKpXk6H7s1URjV9bI%2Fazure-portal-basic-vm-4.png?generation=1586610276276669\&alt=media)

Click the `Create` button at the bottom

### Creating a Virtual machine by filling a form

Fill information about the resource group name in project details

![Choose resource group](https://441555962-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M4co4Py2DyRvsKhKa-u%2F-M4dKiFJor0gJgjeW_pX%2F-M4dKpXmXAlW_H3oVU60%2Fazure-portal-basic-vm-5.png?generation=1586610276622514\&alt=media)

Fill in instance details

![Instance details information](https://441555962-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M4co4Py2DyRvsKhKa-u%2F-M4dKiFJor0gJgjeW_pX%2F-M4dKpXoH74HsmNlx89j%2Fazure-portal-basic-vm-6.png?generation=1586610276917498\&alt=media)

Select a VM size by clicking on `Change Size`. Select `B1s` for now.

![Select a VM size](https://441555962-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M4co4Py2DyRvsKhKa-u%2F-M4dKiFJor0gJgjeW_pX%2F-M4dKpXqHIN3tqNCmYmY%2Fazure-portal-basic-vm-7.png?generation=1586610278112815\&alt=media)

SSH key details. Read the public key from the student VM by `cat ~/.ssh/id_rsa.pub`

![SSH key details](https://441555962-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M4co4Py2DyRvsKhKa-u%2F-M4dKiFJor0gJgjeW_pX%2F-M4dKpXsYFwNHDCkubya%2Fazure-portal-basic-vm-8.png?generation=1586610277068473\&alt=media)

Inbound port information

![Inbound port information](https://441555962-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M4co4Py2DyRvsKhKa-u%2F-M4dKiFJor0gJgjeW_pX%2F-M4dKpXuC_zgpAaIA21x%2Fazure-portal-basic-vm-9.png?generation=1586610278366543\&alt=media)

Configuration validated

![Validation passed](https://441555962-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M4co4Py2DyRvsKhKa-u%2F-M4dKiFJor0gJgjeW_pX%2F-M4dKpXwEGt1DcwGhkWt%2Fazure-portal-basic-vm-10.png?generation=1586610277889725\&alt=media)

Deployment is underway

![Deployment is underway](https://441555962-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M4co4Py2DyRvsKhKa-u%2F-M4dKiFJor0gJgjeW_pX%2F-M4dKpXy5-KaK85RDQPd%2Fazure-portal-basic-vm-10b.png?generation=1586610276706967\&alt=media)

Deployed

![Deployed](https://441555962-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M4co4Py2DyRvsKhKa-u%2F-M4dKiFJor0gJgjeW_pX%2F-M4dKpY-uZI_eNGbxbPY%2Fazure-portal-basic-vm-10c.png?generation=1586610278450548\&alt=media)

### Connecting to our newly setup virtual machine

Once VM is up, SSH to it

![Click connect](https://441555962-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M4co4Py2DyRvsKhKa-u%2F-M4dKiFJor0gJgjeW_pX%2F-M4dKpY1BLx1ZlDqhp-P%2Fazure-portal-basic-vm-11.png?generation=1586610277501160\&alt=media)

SSH information we need to for connecting. Step 4 is what you need. Your private key is already added to ssh agent on the student machine. Use the command without the `-i` flag else to follow the screen, the private key is the `~/.ssh/id_rsa` file on the student machine.

![SSH information to use for connecting](https://441555962-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M4co4Py2DyRvsKhKa-u%2F-M4dKiFJor0gJgjeW_pX%2F-M4dKpY31KVmvLuF6n-D%2Fazure-portal-basic-vm-12.png?generation=1586610277251105\&alt=media)

A complete Ubuntu Server setup on the internet for our use in less than 5 minutes

![Logged in using SSH](https://441555962-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M4co4Py2DyRvsKhKa-u%2F-M4dKiFJor0gJgjeW_pX%2F-M4dKpY5WFDbkyv7K67b%2Fazure-portal-basic-vm-13.png?generation=1586610277802203\&alt=media)

## Additional Exercise

As an exercise to continue practising after the training, attempt to do the following

1. Configure the Azure Virtual Machine's firewall to allow SSH access only from the attacker machine
2. Make a copy of the private key from the student machine's `~/.ssh/id_rsa` folder or add a new public key to the Azure virtual machine
3. Verify that the Azure Virtual Machine firewall allows access as per the rules you have defined
