DEV Community

Cover image for Deploying a Resource Group and Virtual Machine using PowerShell
Yemisi Oyesainu
Yemisi Oyesainu

Posted on

Deploying a Resource Group and Virtual Machine using PowerShell

Azure PowerShell is a collection of cmdlets that is used for managing Azure resources directly from PowerShell. It is a cross-platform PowerShell module that is compatible with Windows, macOS and Linux computers
It requires Windows PowerShell or PowerShell environment to function.

The following are the basic steps to take in creating a resource group and deploying virtual machine using PowerShell

1)Log in to Azure portal and click on Cloud Shell

Image description

Image description
Select PowerShell
Image description

2)Create Storage account if required to do so especially when it is indicated that no storage is mounted. But in this case we have an existing Storage account

3)Create the Resource Group before creating the Virtual machine which is a resource.
Copy the command line you want to use to create the resource group that I named myResourceGroup and paste it on the terminal window

Image description

Then press Enter

Image description
The resource group has been created

4)Copy the command that you want to use to create the virtual machine and paste it on the Powershell terminal window.I will name the virtual machine myVM
Then press enter and input the username and password
My Username is Azureuser and Password is Password123*
Image description

Image description

The virtual machine, myVM has been created

Image description

5)To confirm this, go to azure portal and check for the name of the Resource group and the Virtual Machine, myResourceGroup and myVM

Image description

Image description

Image description

6)To connect to the Virtual machine, Click on Connect

Image description
Download the RDP file and open it

Image description
Click on Connect and input the Username:Azureuser and Password:Password123*
Then click ok

Image description

Image description
Click Yes

Image description
We have successfully connected to the Virtual Machine

7)Check Azure Advisor for best practices that can be applied for the virtual machine created
Go back to myResourceGroup and click on myVM

Image description

Image description

Click on the Hamburger Icon on the top left-hand corner of Azure portal and Select Advisor from the Menu

Image description
Yeah! The Advisor has brought up one recommendation

Image description

Image description

The recommendation is to use NAT gateway for Outbound Connectivity
Yes! Microsoft Azure is very friendly and interesting to use

If you find this article helpful, kindly give a feedback

Top comments (0)