Skip to content

Instantly share code, notes, and snippets.

@vquaiato
Created February 8, 2011 19:44
Show Gist options
  • Save vquaiato/817052 to your computer and use it in GitHub Desktop.
Save vquaiato/817052 to your computer and use it in GitHub Desktop.
"Push" deploy on Windows Azure
Param($S,$I,$Cert,$L,$P,$Cfg)
$start = Get-Date
$service_name = $S
$subscription_id = $I
$certificate = $Cert
$label = $L
$package = $P
$config_file = $Cfg
if(-not(Get-PSSnapin AzureManagementToolsSnapIn))
{
Add-PSSnapin AzureManagementToolsSnapIn
}
New-Deployment -ServiceName $service_name -SubscriptionId $subscription_id -Certificate $certificate -Slot staging -Package $package -Configuration $config_file -Label $label |
Get-OperationStatus -WaitToComplete
Get-HostedService -ServiceName $service_name -SubscriptionId $subscription_id -Certificate $certificate |
Get-Deployment -Slot staging |
Set-DeploymentStatus running |
Get-OperationStatus -WaitToComplete
Get-HostedService -ServiceName $service_name -SubscriptionId $subscription_id -Certificate $certificate |
Get-Deployment -Slot staging |
Move-Deployment |
Get-OperationStatus -WaitToComplete
Get-HostedService -ServiceName $service_name -SubscriptionId $subscription_id -Certificate $certificate |
Get-Deployment -Slot staging |
Set-DeploymentStatus suspended |
Get-OperationStatus -WaitToComplete
Get-HostedService -ServiceName $service_name -SubscriptionId $subscription_id -Certificate $certificate |
Get-Deployment -Slot staging |
Remove-Deployment |
Get-OperationStatus -WaitToComplete
$end = Get-Date
"Deploy finished in " + ($end-$start).TotalSeconds + " secs."
@vquaiato
Copy link
Author

vquaiato commented Feb 8, 2011

Usage:
.'.\push.ps1' -S "service_name" -I "your_subscription_id" -Cert (Get-Item cert:\CurrentUser\My<thumb_print>) -L "label_name" -P ".cspkg local" -Cfg ".cscfg local"

@juanplopes
Copy link

Simple as that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment