是否可以配置源代码控制存储库以通过 Powershell 将代码部署到 Azure Web App 插槽。 (甚至只是主站点)
非常适合 v2/ARM,但我现在愿意考虑任何事情!
我已经查看了 AzureRM.Websites 模块中可用的命令,但似乎没有任何内容。
附注我知道这可以通过模板实现,我目前正在寻找纯 Powershell 命令。
最佳答案
您可以使用“低级”ARM CmdLets 来完成此操作。例如对于主站点:
$props = @{
RepoUrl = $repoUrl
Branch = "master"
}
New-AzureRmResource -ResourceGroupName $ResourceGroupName -ResourceType Microsoft.Web/sites/SourceControls -Name $SiteName/Web -PropertyObject $props -ApiVersion 2015-08-01 -Force
对于插槽(使用相同的 $props
):
New-AzureRmResource -ResourceGroupName $ResourceGroupName -ResourceType Microsoft.Web/sites/slots/sourcecontrols -Name $SiteName/$SlotName/Web -PropertyObject $props -ApiVersion 2015-08-01 -Force
另请参阅示例辅助方法 here 。该设置设置了 IsManualIntegration = true
,这适用于您不拥有的存储库,并且需要手动同步。对于持续部署,请保留 IsManualIntegration
。
关于powershell - 如何通过 Powershell 为 Azure 配置 github 等,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34572032/