How to create VM with PowerShell

Adedapo - May 21 - - Dev Community

PowerShell

PowerShell is a cross-platform task automation framework developed by Microsoft, consisting of a command-line shell and an associated scripting language. It is designed to automate the management of computer systems and build, test, and deploy solutions, often in DevOps and IT environments.

Virtual Machine

A Virtual Machine (VM) is a software-based emulation of a physical computer. It runs an operating system and applications just like a physical machine, but it is executed on a host system using virtualization technology. VMs allow multiple operating systems to run concurrently on a single physical computer.

Steps to create a Virtual Machine from PowerShell
Step 1
On Azure portal click on Cloud Shell
Cloud shell

Step 2
click on PowerShell, if not click on the dropdown at the top of the shell to change to PowerShell
PowerShell

Step 3
click on Mount a storage, choose your subscription and click Apply
Apply

Step 4
If you dont have any storage account, click i want to create storage account and click next
storage

Step 5
Input Resource group, Region, Storage Account name and File share name
resource group name

NOTE: wait for it to deploy
Step 6
Enter the following code to create a Resource Group New-AzResourceGroup -Name 'inputresource group name' -Location 'enter location'
resource group

Step 7 (Final)
Enter this code: "New-AzVm", and entercredentials
vm

Check your your resource group to see the VM created

. . . . . . . . . . . . . . . . .