使用Powershell进行Azure应用服务部署(无FTP)

时间:2017-03-20 17:39:19

标签: azure azure-deployment azure-app-service-envrmnt

我有一个在Azure中作为Paas运行的ASP.NET应用服务, 我想要的是简单的powershell脚本,只需部署由jenkins生成的ASP.NET构建,所以只需xcopy就可以工作(没有FTP)。

互联网上有太多的资源和选项,特定的输入将不胜感激。

2 个答案:

答案 0 :(得分:1)

我会研究msdeploy。这是部署Azure App Services的一种非常强大的方式。

答案 1 :(得分:0)

感谢Mike的输入,你的输入最终看起来像是PowerShell脚本。

#param([string]$packageFolderPath,[string]$publishProfilePath)

[string]$packageFolderPath = "C:\Site"
[string]$publishProfilePath = "C:\Publish\app-local1.PublishSettings"

#Get publish-settings from file
[xml]$xml=Get-Content($publishProfilePath)
[string]$azureSite=$xml.publishData.publishProfile.msDeploySite.get(0)
[string]$azureUrl=$xml.publishData.publishProfile.publishUrl.get(0)
[string]$azureUsername=$xml.publishData.publishProfile.userName.get(0)
[string]$azurePassword=$xml.publishData.publishProfile.userPWD.get(0)
[string]$computerName ="`"https://$azureUrl/msdeploy.axd?site=$azureSite`""

msdeploy.exe -verb:sync -source:contentPath=$packageFolderPath -dest:contentPath=$azureSite,ComputerName=$computerName,UserName=$azureUsername,Password=$azurePassword,AuthType='Basic'

Write-Output "Done !"