Windows PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and associated scripting language, built on the .NET Framework.

You can search for it, using Windows Search, but probably you already have it installed on your computer.

powershell

On top of the standard command-line shell, you can also find the Windows PowerShell ISE, which stands for Integrated Scripting Environment, and is a graphical user interface that allows you to easily create different scripts without having to type all the commands in the command line.

powershell-ise

In order to connect your Azure Subscription with Powershell, you need to follow the steps below.

Step 1: Install Latest Azure Tools

You can install the latest Azure Tools using Web Platform Installer, which provides an easy way to download and install all the latest components of the Microsoft Web Platform.

web-platform-installer-azure-powershell

Step 2: Get Azure Publish Settings File

First of all, you have to configure the connectivity between your computer and Azure. In order to do that, you need to download the Azure Publish Settings File which contains secure credentials and additional information on your subscription.

To obtain this file, type at the Windows Powershell command prompt

Get-AzurePublishSettingsFile

After hitting enter, a web browser will open at https://manage.windowsazure.com/publishsettings for signing into Azure. Then, your subscription file will be generated and the download will begin shortly after.

Step 3: Import publish settings file

Assuming that the file has been saved to “C:\Azure\mysettings.publishsettings” path, you can import it

Import-AzurePublishSettingsFile -PublishSettingsFile "C:\Azure\mysettings.publishsettings"

You can check that it is now included in your machine certificates

Get-ChildItem -Recurse cert:\ | Where-Object {$_.Issuer -like '*Azure*'} | select FriendlyName, Subject

Step 4: Set default Azure Subscription

Afterwards, in case you have multiple subscriptions linked to your machine, you can list them using

Get-AzureSubscription | Select SubscriptionName

and select the one you want, as default

Select-AzureSubscription -SubscriptionName "BizSpark"

To validate your current subscription, simply type

Get-AzureSubscription -Current

where you will get all available details about your current subscription.

Simple Commands

Now that you have a secure link to your subscription, you can use the command below to get your available storage accounts

Get-AzureStorageAccount | Select StorageAccountName, AccountType, Endpoints

or

Get-AzureVM

to return Virtual Machines available in your subscription.

Certificate Management

Every certificate that was generated is now listed under Settings > Management Certificates at the old windows azure portal, where you have the option to upload a new one or delete any of the existing ones.

azure-certificate-management

Categorized in:

Tagged in:

,