Windows Azure PowerShell – Getting Started


Introduction:

As per command line tools, almost all operations that are performed on the Platform can be done using Rest API and PowerShell. Windows Azure PowerShell releases are very frequent.

Download Page: http://www.windowsazure.com/en-us/downloads/?fb=en-us

[Last Release: February 2013]

Getting Started:

Step1: Installation

  1. Download Windows Azure PowerShell from above link.

     

  2. Select Windows Azure PowerShell click Add then Install.
  3. It install independent PowerShell module for windows Azure.

We will be using Windows PowerShell instead of Windows Azure PowerShell.

Step 2: Configuration

  1. Open Windows PowerShell and to make sure Azure PowerShell l module is available

    PS C:\> Get-Module –ListAvailable

    Directory: C:\Program Files (x86)\Microsoft SDKs\Windows Azure\PowerShell

    ModuleType Name ExportedCommands

    ———- —- —————-

    Binary Azure {Get-AzurePublishSettingsFile, Get-AzureSubscription, Import-AzurePub…

     

  2. Import Azure Module in PowerShell

    PS C:\> Import-Module Azure

     

  3. AzurePublishSettingsFile needs to be imported in PowerShell to perform an operation. (#Only Once)

    PS C:\> Get-AzurePublishSettingsFile

    This command will open a browser which may prompt for live account (associated with Windows Azure) credentials to download a file with .publishSettings extension.

    PS C:\> Import-AzurePublishSettingsFile “C:\Users\user1\Desktop\2-17-2013-credentials.publishsettings”

  4. Just to Verify that PowerShell is talking to Windows Azure :

    PS C:\> Get-AzureSubscription

    This command will display following detail:

     

    To Get List of All available Windows Azure Powershell Command:

    For a list of all Azure cmdlets type ‘help azure’.

    For Node.js cmdlets type ‘help node-dev’.

    For PHP cmdlets type ‘help php-dev’.

    For Python cmdlets type ‘help python-dev’.

     

     

Many thanks to Avkash Chauhan for review and valuable inputs.

Keywords: Windows Azure PowerShell, Configuration.

——————–

Abhishek Anand

Support Escalation Engineer

Windows Azure Technical Support

Comments (1)

  1. Aravind - aravindgcal@gmail.com says:

    Hello All,

    I am posting this to help some one look to start and stop VM's

    After struggling i am able to simplify using log-in method instead of publish profile:

    one default account can be created and can be used among project group of people.

    +++++++++++++++++++++++++++++++++++++++++++++++myscripting.ps1+++++

    azure login;

    Import-Module Azure ;

    Get-AzureSubscription;

    write-host "Choose the options to Start and Stop your Azure VMS"

    write-host "1. Stop Azure VM"

    write-host "2. Start Azure VM"

    write-host "3. Restart Azure VM"

    $answer = read-host "Please Select Your Choice"

    Switch($answer)

    {

       1{ $vmname = read-host "Please Enter VM Name";

    Stop-AzureVM -Name $vmname -ServiceName $vmname -Force}

       2{ $vmname = read-host "Please Enter VM Name";

    Start-AzureVM -Name $vmname -ServiceName $vmname}

    3{ $vmname = read-host "Please Enter VM Name";

    Restart-AzureVM -Name $vmname -ServiceName $vmname}

    }

    ++++++++++++++++++++++++++++++++++++++++++++++++++++

    It really worked for me ….

    Batch file

    i am able to execute from example.bat

    ++++++++++++++++++++++++++++++++++++ example.bat+++++++

    powershell -executionPolicy bypass -noexit -file "path to themyscripting.ps1"

    ++++++++++++++++++++++++++++++++++++++++

Skip to main content