Azure with PowerShell

Hello,

I recently started to play with Azure with PowerShell.When you use Azure, you have severals options :

  1. Old Web portal
  2. Beta Web portal
  3. PowerShell
  4. AzureCLI

Today, we’ll have a look at the PowerShell option. First, you’ll need to download and install it.

PowerShell 5 way (OneGet – PackageManagement):

Find-Package AzurePowerShell | Install-Package

PowerShell <5, you’ll need to do it manually, you can find the package to download here.

Once installed, you may want to connect, you have two options for that :

  1. Login at each PowerShell start
  2. Download a special file to authenticate you automatically

Option 1

Add-AzureAccount

This will popup a window when you can enter your Azure credentials :

Azure-IaaS-PowerShell-1

Option 2 :

The first cmdlet will help you to download a special file, and the second will import it, you may need to change the path to your special file.

Get-AzurePublishSettingsFile
Import-AzurePublishSettingsFile "C:Users$env:usernameDownloadsMySubscription-6-3-2015-credentials.publishsettings"

Once you’re connected, you can start using all the cmdlets included in the Azure PowerShell module (641 of them in version 0.8.16 of the module) :

Azure-IaaS-PowerShell-2

A lot of them looks like the ones from Hyper-V module.

You can check if you’re connected by looking at the subscriptions on your Azure tenant :

Get-AzureSubscription

You can then choose the one you want to work with :

Select-AzureSubscription -SubscriptionName 'MySubscriptionName'

 

Leave a Reply