Skip to content

Instantly share code, notes, and snippets.

@dibble-james
Last active January 22, 2016 22:12
Show Gist options
  • Save dibble-james/48990d192b7739b76b46 to your computer and use it in GitHub Desktop.
Save dibble-james/48990d192b7739b76b46 to your computer and use it in GitHub Desktop.
A Publish script for Azure Websites with multiple hostnames
param($websiteName, $packOutput)
$website = Get-AzureWebsite -Name $websiteName
# Debug dump the enabled hostnames on the site to check it has an scm
Write-Host "Enabled Host Names"
foreach($hostname in $website.EnabledHostNames)
{
Write-Host "$hostname`n"
}
# get the scm url to use with MSDeploy.
$msdeployurl = $website.EnabledHostNames | Where { $_.Contains(".scm.") } | Select -First 1
$publishProperties = @{'WebPublishMethod'='MSDeploy';
'MSDeployServiceUrl'=$msdeployurl;
'DeployIisAppPath'=$website.Name;
'Username'=$website.PublishingUsername;
'Password'=$website.PublishingPassword}
$publishScript = "${env:ProgramFiles(x86)}\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\Publish\Scripts\default-publish.ps1"
. $publishScript -publishProperties $publishProperties -packOutput $packOutput
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment