Pages

Monday, October 11, 2010

Quick Status of Your Windows Azure Apps with PowerShell


Inspired by David Aiken’s one-liner, I’ve been playing around with what’s possible using PowerShell and theWindows Azure Service Management CmdLets. I thought I’d share two of my own one-liners that help me get the status of all my Windows Azure applications at once.
Here’s the first one-liner:
get-hostedservices -cert $cert -subscriptionid $sub | get-deployment production | where { $_.roleinstancelist -ne $null } | select -expandproperty roleinstancelist | group instancestatus | fl name, count
This counts how many of my instances are Ready, Busy, Initializing, etc. Here’s a sample output:
Name: Ready
Count : 18

Name : Initializing
Count : 1
Here’s the other one-liner I came up with, slightly more complicated:
get-hostedservices -cert $cert -subscriptionid $sub | get-deployment production | where {$_.RoleInstanceList -ne $null} | ft servicename, @{expression={$_.roleinstancelist.count}; label='Instance Count'; alignment='left'}
This one lists all my production deployments along with the total number of instances that deployment has. Here’s a sample output:
ServiceName                             Instance Count
-----------                             --------------
annoysmarx                              4
hwctest                                 2
onebigslide                             4
slupload                                2
smarxblog                               3
Have you played yet with the Windows Azure Service Management CmdLets? Do you have any cool scripts to share? Drop me a line and let me know what you come up with.

No comments:

Post a Comment