【问题标题】:Azure app service deployment with Powershell (No FTP)使用 Powershell 部署 Azure 应用服务(无 FTP)
【发布时间】:2017-03-23 08:31:07
【问题描述】:

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

互联网上的资源和选项太多,不胜感激。

【问题讨论】:

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


    【解决方案1】:

    我会调查 msdeploy。这是一种非常强大的方式来部署到 Azure 应用服务。

    【讨论】:

    • 是的,我发现它非常强大,感谢您的输入,将再等 1 天查看其他解决方案。
    【解决方案2】:

    感谢 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 !"
    

    【讨论】: