Add An Azure Virtual Machine Using Cloud Shell

In order to add a virtual machine to Microsoft Azure by using the cloud shell, first log into the Azure Portal account. Go to:
Https://shell.azure.com/powershell – give it a few seconds, and the interface opens:

Azure Cloud Shell

First thing to do: create a new resource group [RG] for the virtual machine, unless there is already a particular resource group available for this virtual machine. Name the RG intuitively. I own the ‘MSCloudSys.Com’ domain, so I named it similarly. I also want this to be located in the West part of the USA. Give this command [or “cmdlet”] to begin creating a new RG:

“New-AzResourceGroup -Name myMSCloudSys”

Azure Cloud Shell Resource Group

After the new resource group is created successfully, the virtual machine can be created and essentially, put inside the new resource group. The ‘cmdlet’ is:

“New-AzVm” – it is followed by the needed parameters: the VM name, the RG, the Location [region], the VNET + Subnet, the Network Security Group [NSG], and the public IP + ports to be opened. In addition, there will be username and password credentials needed:

Azure New-AzVm

The Azure virtual machine is being created …

Azure New Virtual Machine via Shell

Upon completion, the summary can be seen, including VM and RG name, and various IDs:

Azure Cloud Shell

What about accessing the new virtual machine? We need an address. At the cloud shell, quickly obtain the public facing IP address with this: “Get-AzPublicIpAddress” + needed parameters:

Azure Cloud Shell Get-AzPublicAddress

One option is to quickly open PowerShell on the local PC and issue this ‘cmdlet’:

“mstsc /v:40.118.233.184”

Log into Azure Virtual Machine with MSTSC

From the Azure Portal, the brand new virtual machine and associated resources can be seen:

Azure Portal All Resources