Azure PowerShell Basics

To download Azure PowerShell, open URL azure.microsoft.com à download à PowerShell.

Pre-Requisites for Cross platform and other services are: Visual Studio 2015 & VS 15 Preview Azure.

Three modules get installed part of Azure PowerShell installation

  1. Azure (Azure service management)
  2. AzureResourceManager
  3. AzureProfile

Two modes to connect to Azure via PowerShell

  1. Azure Service Management
  2. Azure Resource Manager
  • With Certificate method login, you will have only Azure Service Management Mode.
  • With Azure Login Method, you will have both Azure Service Management and Azure Resource Manager mode.
  • Be default using Azure account login method in PowerShell, you log into Azure Service Management mode. To switch to Azure Resource Manager mode.

Switch-AzureMode -Name AzureResourceManager

Using Certificate Login Method

  • Get-AzurePublishSettingsFile - will download the credential file post login, save the file. File contains subscription ID and managed certificates.

  • Import the file in Powershell - Import-AzurePublishSettingsFile <Path with file name>

  • Get-AzureSubscription
  • Get-AzureVM (lists all VMs created under the subscription)
  • Get-AzureVM | f1 (to get VM details)

  • Remove-AzureSubscription <Subsciption Name> (to remove the subscription from Azure - disconnect in Azure)

Using Azure Account Login Method

  1. Add- AzureAccount (promt to login with email id and pwd)
  2. Get- AzureSubscription
  3. Get- AzureVM
  4. Remove- AzureAccount -Name <DefaultAccount (email account) >

To Get all Azure PowerShell Commands

Get-Command -Module Azure | Get-Help | Format-Table Name, Synopsis -Wrap | Out-File C:\temp\azurehelp.txt

Ebook Download
View all
Learn
View all