Project Description
A set of PowerShell cmdlets wrapping the Windows Azure Service Management API. These cmdlets make is simple to script out your deployments, upgrades, and scaling of your Windows Azure applications.
Supported Operations
The Windows Azure Service Management CmdLets support the following operations:
Affinity Group Operations
- Get-AffinityGroup
- Get-AffinityGroups
Service Operations
- Get-Certificate
- Get-Certificates
- Get-HostedProperties
- Get-HostedService
- Get-HostedServices
Service Upgrade and Deployment Operations
- Add-Certificate
- Get-Deployment
- Move-Deployment
- New-Deployment
- Remove-Certificate
- Remove-Deployment
- Set-Deployment
- Set-DeploymentConfiguration
- Set-DeploymentStatus
- Set-WalkUpgradeDomain
Status Operations
Storage Service Operations
- Get-StorageKeys
- Get-StorageProperties
- Get-StorageServices
- New-StorageKey
For more information on the Service Management API, please consult the
MSDN documentation
Example Uses
The following script gets an existing deployment, shuts it down, deletes it, creates a new one in it's place, starts it, and then scales the 'WebUx' role by 1 instance.
$cert = Get-Item cert:\CurrentUser\My\D6BE55AC439FEA8CBEBAFF432BDC0780F1BD00CF
$sub = "CCCEA07B-1E9A-5133-8476-3818E2165063"
$servicename = 'myazureservice'
$package = "c:\publish\MyAzureService.cspkg"
$config = "c:\publish\ServiceConfiguration.cscfg"
Add-PSSnapin AzureManagementToolsSnapIn
Get-HostedService $servicename -Certificate $cert -SubscriptionId $sub |
Get-Deployment -Slot Production |
Set-DeploymentStatus 'Suspended' |
Get-OperationStatus -WaitToComplete |
Get-HostedService $servicename -Certificate $cert -SubscriptionId $sub |
Get-Deployment -Slot Production |
Remove-Deployment |
Get-OperationStatus -WaitToComplete
Get-HostedService $servicename -Certificate $cert -SubscriptionId $sub |
New-Deployment Production $package $config -Label 'v.Next' |
Get-OperationStatus -WaitToComplete
Get-HostedService $servicename -Certificate $cert -SubscriptionId $sub |
Get-Deployment -Slot Production |
Set-DeploymentStatus 'Running' |
Get-OperationStatus -WaitToComplete
Get-HostedService $servicename -Certificate $cert -SubscriptionId $sub |
Get-Deployment -Slot Production |
Set-DeploymentConfiguration {$_.RolesConfiguration["WebUx"].InstanceCount += 1}
A simple script to upgrade a single role or the entire deployment:
$cert = Get-Item cert:\CurrentUser\My\D6BE55AC439FEA8CBEBAFF432BDC0780F1BD00CF
$sub = "CCCEA07B-1E9A-5133-8476-3818E2165063"
$servicename = 'myservice'
$package = "http://myaccount.blob.core.windows.net/publish/MyPackage.cspkg"
$label = 'nolabel'
$role = ''
if ($args.Length -eq 2)
{
$role = $args[0]
$label = $args[1]
}
if ($args.Length -eq 1)
{
$label = $args[0]
}
if ($role -ne '')
{
Get-HostedService $servicename -Certificate $cert -SubscriptionId $sub |
Get-Deployment -Slot Production |
Set-Deployment -mode Auto -roleName $role -package $package -label $label |
Get-OperationStatus -WaitToComplete
}
else
{
Get-HostedService $servicename -Certificate $cert -SubscriptionId $sub |
Get-Deployment -Slot Production |
Set-Deployment -mode Auto -package $package -label $label |
Get-OperationStatus -WaitToComplete
}
Please note that during the free CTP, you will only be able to scale your services to 2 instances per role.