DEV Community

Cover image for How to create a Virtual Machine and Resource Group using Azure Powershell
Adisa Oluwaseyi
Adisa Oluwaseyi

Posted on

How to create a Virtual Machine and Resource Group using Azure Powershell

Creating Resource Group and Virtual Machine with Powershell

Step 1:
Visit portal.azure.com, login or sign up if you don't have an account, you can get a free account at azure.microsoft.com/en-us/free/

Step 2:
On the Azure portal page click the icon on the top right corner, then click powershell

Image description

Step 3:
Click show advanced settings to create a storage account if you don't have one

Image description

Step 4:
On the storage account field enter a storage name of your choice, also enter a file share name of your choice, then click create storage

Image description

Step 5:
To create a resource group paste this codes into your powershell:

New-AzResourceGroup -Name ‘mycoolerRg’ -Location ‘EastUS’
Enter fullscreen mode Exit fullscreen mode

for the resource group name i will be using "mycoolerRg" you can use any name of your choice

Image description

Step 6:
To create a Virtual Machine paste these codes into your powershell:

New-AzVm `
    -ResourceGroupName "myCoolerRg” `
    -Name "myVMps” `
    -Location "East US" `
    -VirtualNetworkName "myVnetPS” `
    -SubnetName "mySubnetPS” `
    -SecurityGroupName "myNSGPS” `
    -PublicIpAddressName "myPublicIpPS”
Enter fullscreen mode Exit fullscreen mode

for user enter anyname of your choice, password also use any password of your choice

Image description

Confirming the Resource Group and Virtual Machine created

Step 1:
Go to Azure portal page search for resource group and click resource group

Image description

Step 2:
Here is the resource group created, click it

Image description

Step 3:
As you can see here is the Virtual Machine we created with Azure Powershell

Image description

Thank you for reading!!!

Top comments (0)