Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- param (
- [Parameter(Mandatory=$true)]
- [string]$PublishSettingsFile,
- [Parameter(Mandatory=$true)]
- [string]$DeploymentBatch,
- [Parameter(Mandatory=$true)]
- [string]$WebAppUrl,
- [switch]$Deploy
- )
- # generate the kudu address for the Azure Web App url
- function GetTargetDeploymentUrl
- {
- param (
- [Parameter(Mandatory=$true)]
- [string]$Url
- )
- $result = ""
- $i = $Url.IndexOf(".")
- if ($i -ge 0)
- {
- $result = $Url.Insert($i, ".scm")
- }
- return $result
- }
- # read the deployment credentials from the publish settings file
- [xml]$publishSettings = Get-Content $PublishSettingsFile
- $webDeployNode = $publishSettings.SelectSingleNode("/publishData/publishProfile[@publishMethod='MSDeploy']")
- $userName = $webDeployNode.userName
- $password = $webDeployNode.userPWD
- # get the web address to deploy to
- $deploymentUrl = GetTargetDeploymentUrl -Url $WebAppUrl
- if ($deploymentUrl -eq "")
- {
- Write-Host -ForegroundColor Red "Cannot generate target deployment url."
- }
- else
- {
- # call the deployment batch and perform deployment
- Write-Host -ForegroundColor Magenta "Deploy to $deploymentUrl"
- $deploymentUrl = $deploymentUrl + "/MSDeploy.axd"
- if ($Deploy -eq $True)
- {
- & $DeploymentBatch /Y "/M:$deploymentUrl" /U:$userName /P:$password /a:Basic
- }
- else
- {
- & $DeploymentBatch /T "/M:$deploymentUrl" /U:$userName /P:$password /a:Basic
- }
- }
- Write-Host -ForegroundColor Green "Done."
Add Comment
Please, Sign In to add comment