This is a list of the most used and useful PowerShell commands I use in Microsoft Azure, I will keep this guideline updated time to time.

Install PowerShell navigating in the link below and selecting PowerShell (Specific OS) at the bottom

https://azure.microsoft.com/en-us/downloads/

 

Script

Comment

https://github.com/Azure/azure-powershell

To install Azure PowerShell

http://ninocrudele.com/azure-and-powershell-installation-and-quick-fixes

To install Azure PowerShell and some quick fixes

Find-Module -Name AzureRM | install-module -AllowClobber

To install the AzureRM module and force all overriding

Update-Help -Force

To force an update of the AzureRM modules

$PSVersionTable.PSVersion

Check your PowerShell version

Login-AzureRmAccount

Used to login into azure account

Set-AzureRmContext -SubscriptionName ‘mysubscription’

To switch between the subscriptions

https://gallery.technet.microsoft.com/Set-Azure-Resource-Manager-f7509ec4

Changing the availability group in an existing Azure VM is not currently available in the Azure Portal.

Get-ExecutionPolicy

Check the script execution policy setting

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Confirm

Set the script execution policy setting

git –version

Check that git is accessible from PowerShell.
If git is not recognized as the name of a command verify that you have Git installed. If not, install Git from https://git-scm.com

Get-AzureRmVMSize -Location $locName | Select Name

Get all tiers available per reagion

Enter-PSSession -ComputerName 10.0.0.1 -Credential Get-Credential

Start a remote session (Enable the WinRM in the NSG)

https://gallery.technet.microsoft.com/scriptcenter/List-all-VMs-in-all-fc092c02

Get all Azure VM in All Subscriptions

Get-AzureRmVMSize -ResourceGroupName “Name” -VMName “Name”

Get Azure VM sizes

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here