Skip to content

Instantly share code, notes, and snippets.

@SyntaxC4
Last active December 10, 2015 11:08
Show Gist options
  • Save SyntaxC4/4425480 to your computer and use it in GitHub Desktop.
Save SyntaxC4/4425480 to your computer and use it in GitHub Desktop.
#Gracefully Add the Windows Azure Service Management SnapIn
Add-PSSnapin -Name AzureManagementToolsSnapIn -ErrorAction SilentlyContinue
#Collect Required Variables
$serviceName = $args[0]
$slot = $args[1]
$subscriptionId = $args[2]
$certThumb = $args[3]
$package = $args[4]
$label = $args[5]
#Retrieve the Management Cert from the Current User Personal Cert Store
$cert = Get-Item cert:\CurrentUser\My\$certThumb
#Find the Current Directory of the Executing Script
$fullPathIncFileName = $MyInvocation.MyCommand.Definition
$currentScriptName = $MyInvocation.MyCommand.Name
$currentExecutingPath = $fullPathIncFileName.Replace($currentScriptName, "")
#Deploy the New Service
Get-HostedService $serviceName -SubscriptionId $subscriptionId -Certificate $cert |
Get-Deployment $slot |
New-Deployment -package $package -configuration "$currentExecutingPath\ServiceConfiguration.cscfg" -label $label
#Wait for the Service to Upload
sleep 30
#Start the new Deployment
Set-DeploymentStatus -serviceName $serviceName -subscriptionId $subscriptionId -Certificate $cert -status running -slot $slot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment