Azure VM PowerShell is a powerful command-line tool that lets you manage Azure VMs. To get started, first install the Azure PowerShell module. Then, you can use the Azure cmdlets to manage your VMs.
To get started, first open the Azure PowerShell command-line interface (CLI). Then, type the following command to get a list of all the Azure cmdlets.
Get-Command -Module Azure
To get information about a particular Azure cmdlet, you can use the Get-Help command. For example, to get help about the New-AzureVM cmdlet, you can type the following command.
Get-Help New-AzureVM
To use the New-AzureVM cmdlet, you first need to create a new Azure VM. To do this, you can use the New-AzureVM cmdlet.
For example, the following command creates a new Azure VM named myVM.
New-AzureVM -Name myVM
After you create the new Azure VM, you can use the following commands to manage it. For example, the following command starts the myVM VM.
Start-AzureVM myVM
The following command stops the myVM VM.
Stop-AzureVM myVM
The following command takes the myVM VM offline.
Disable-AzureVM myVM
The following command brings the myVM VM online.
Enable-AzureVM myVM
The following command changes the name of the myVM VM.
Set-AzureVM myVM -Name myNewVM
The following command removes the myVM VM.
Remove-AzureVM myVM
The following command returns the myVM VM to the default configuration.
Set-AzureVM myVM -DefaultConfiguration
The following command updates the myVM VM with the latest updates.
Update-AzureVM myVM
The following command deletes the myVM VM.
The following command returns the list of all the Azure VMs that are currently managed by the current user.
Get-AzureVM
The following command returns the list of all the Azure VMs that are currently managed by the current account.
Get-AzureAccount
The following command returns the list of all the Azure VMs that are currently managed by the current subscription.
Get-AzureSubscription
The following command returns the list of all the Azure VMs that are currently in use by the current user.
Get-AzureVMUsage
The following command returns the list of all the Azure VMs that are currently in use by the current account.
Get-AzureAccountUsage
The following command returns the list of all the Azure VMs that are currently in use by the current subscription.
Get-AzureSubscriptionUsage.