How to quickly determine the Windows Azure PowerShell Version


How to quickly determine the Windows Azure PowerShell Version

 

The quickest method to determine which Windows Azure PowerShell version you are running is to enable Debugging and then run a Power Shell command.

 

To enable debugging you just need to set $DebugPreference as below:

 

$DebugPreference =’Continue’

 

Example:

PS C:\Windows\System32\WindowsPowerShell\v1.0> $DebugPreference =’continue’

 

Now you can try any Windows Azure PowerShell command and because shell based debugging is enabled the shell will shows the request and response XML data along with all the headers. The one header we need to pay attention is “User-Agent”. In the User-Agent header we will see exactly what PS  version is making those PS based REST calls.

 

PS C:\Windows\System32\WindowsPowerShell\v1.0>get-azurelocation

 

DEBUG: ============================ HTTP REQUEST ============================

 

HTTP Method:

 GET

 

Absolute Uri:

 https://management.core.windows.net/9f79930d-18a8-40bc-a136-b592c6939aac/locations

 

Headers:

x-ms-version                : 2012-03-01

User-Agent                   : Windows Azure Powershell/v.0.6.10

 

The PowerShell version is contained within the User-Agent string “Windows Azure Powershell/v.0.6.10

 

 

To disable debugging mode all you need to do is execute the following command:

 

PS C:\Windows\System32\WindowsPowerShell\v1.0> $DebugPreference =’Silentlycontinue’

Comments (5)

  1. Sergeim says:

    I get the following (below).

    PS C:> get-azurelocation

    DEBUG: 11:05:14 PM – GetAzureLocationCommand begin processing with ParameterSet '__AllParameterSets'.

    VERBOSE: 11:05:14 PM – Begin Operation: Get-AzureLocation

    get-azurelocation : Call Set-AzureSubscription and Select-AzureSubscription first.

    At line:1 char:1

    + get-azurelocation

    + ~~~~~~~~~~~~~~~~~

       + CategoryInfo          : NotSpecified: (:) [Get-AzureLocation], Exception

       + FullyQualifiedErrorId : System.Exception,Microsoft.WindowsAzure.Commands.ServiceManagement.HostedServices.GetAzu

      reLocationCommand

    PS C:>

  2. Matt Sampson says:

    -Run "Add-AzureAccount" from your Azure PS session

    -Install "Fiddler" and then enabled HTTPS decryption

    -And you should see in Fiddler the USER AGENT version

  3. Remi Faydide says:

    Even if this post is quite old, a better option is now this simple command :

    (Get-Module <module name>).Version

    Major  Minor  Build  Revision

    —–  —–  —–  ——–

    0      8      16     -1

    or simply this one :

    Get-Module Azure

    ModuleType Version    Name                                ExportedCommands

    —————–  ———-    ——–                                —————————-

    Manifest         0.8.16      Azure                               {Add-AzureAccount, Add-AzureApplicationGatewaySslCertifica…

  4. Rémi Faydide says:

    Sorry the first command was more this one :

    (Get-Module Azure).Version than this one (Get-Module <module name>).Version

    The result was made with the Azure Module set in place of <module name>…

  5. Conrad says:

    Azure PowerShell 1.0 Preview is available:

    azure.microsoft.com/…/azps-1-0-pre