powershell - 如何通过 Powershell 为 Azure 配置 github 等

标签 powershell azure azure-web-app-service azure-powershell azure-resource-manager

是否可以配置源代码控制存储库以通过 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/

相关文章:

powershell - 如何为 powershell 脚本设置一些内置变量?

azure - 使用 terraform 创建 Data Lake Storage 表示 datalakestore.Client#GetProperties 即使它具有完全权限

asp.net-mvc - 如何防止 ASP.NET MVC 在 Windows Azure 上处理静态文件(js 和图像)?

java - 如何使用 Azure 应用服务不支持的 Java 版本

c# - 显示来自 azure blob 容器的图像

javascript - 代理 Angular 请求与位于 azurewebsites 的服务 Node

javascript - 如何在Powershell中将实时输出保存到txt文件?监控脚本

powershell - 使用 Powershell 脚本启动的批处理文件设置环境变量

powershell - 在csv导入中修剪对象内容

Azure 机器人部署