Skip to content

Instantly share code, notes, and snippets.

@mcollier
Created April 4, 2013 11:19
Show Gist options
  • Save mcollier/5309605 to your computer and use it in GitHub Desktop.
Save mcollier/5309605 to your computer and use it in GitHub Desktop.
This is a sample script to (1) invoke the build and package create process for a Windows Azure Cloud Service project, and (2) invoke the AzurePublish.ps1 script to publish the Cloud Service project to Windows Azure.
$Error.Clear()
$BuildConfiguration = 'Debug'
Write-Host "*** Starting to build the project ***"
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe c:\Projects\MyApp\MyApp.ccproj `
/p:Configuration=$BuildConfiguration `
/t:CorePublish
if ($LASTEXITCODE -ne 0)
{
throw "Build Failed"
}
Write-Host "*** Finished building the project ***"
$thumbprint = '[YOUR_MANAGEMENT_CERTIFICATE_THUMBPRINT]'
$sub = '[YOUR_WINDOWS_AZURE_SUBSCRIPTION_ID]'
$subscriptionName = '[FRIENDLY_NAME_FOR_YOUR_SUBSCRIPTION]'
$buildPath = 'c:\Projects\MyApp\bin\' + $BuildConfiguration + '\app.publish\'
$packagename = 'MyApp.cspkg'
$serviceconfig = 'ServiceConfiguration.Cloud.cscfg'
$servicename = '[YOUR_CLOUD_SERVICE_NAME]'
$storageaccount = '[YOUR_STORAGE_ACCOUNT_NAME]'
$storagekey = '[YOUR_STORAGE_ACCOUNT_KEY]'
$slot = 'Staging'
$region = 'East US'
Write-Host "*** Starting Windows Azure deployment process ***"
. "C:\Projects\MyApp\scripts\AzurePublish.ps1" -serviceName $servicename -storageAccountName $storageaccount -storageAccountKey $storagekey -cloudConfigLocation $buildPath$serviceconfig `
-packageLocation $buildPath$packagename -selectedSubscription $subscriptionName -thumbprint $thumbprint -subscriptionId $sub -slot $slot -location $region
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment