如何通过Powershell为Azure配置github等

如何通过Powershell为Azure配置github等,powershell,azure,azure-web-app-service,azure-powershell,azure-resource-manager,Powershell,Azure,Azure Web App Service,Azure Powershell,Azure Resource Manager,是否可以配置源代码管理存储库,以便通过Powershell将代码部署到Azure Web应用程序插槽。(甚至只是主站点) 理想情况下为V2/ARM,但我愿意考虑任何事情!p> 我已经查看了AzureRM.Websites模块中可用的命令,但似乎没有任何内容 另外,我知道这可以通过模板实现,我目前正在寻找纯Powershell命令 您可以使用“低级别”ARM cmdlet完成此操作。e、 g.对于主场地: $props = @{ RepoUrl = $repoUrl Branch

是否可以配置源代码管理存储库,以便通过Powershell将代码部署到Azure Web应用程序插槽。(甚至只是主站点)

理想情况下为V2/ARM,但我愿意考虑任何事情!p> 我已经查看了AzureRM.Websites模块中可用的命令,但似乎没有任何内容


另外,我知道这可以通过模板实现,我目前正在寻找纯Powershell命令

您可以使用“低级别”ARM cmdlet完成此操作。e、 g.对于主场地:

$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
):


另请参见示例帮助器方法。该选项设置了
IsManualIntegration=true
,它适用于您不拥有的回购,需要手动同步。对于连续部署,请将
IsManualIntegration
保留在外。

您需要使用New AzureRmResource命令

$webappname = "name of your webapp"
$RepoUrl = "https://github.com/davidebbo-test/Mvc52Application.git"
$branch = "master"
$location = "location of your webapp "
$resourceGroupName = "name of resource group with your webapp"
New-AzureRmResource -Location $location -Properties @{"RepoUrl"="$RepoUrl";"branch"="$branch";"IsManualIntegration"="true"} -ResourceName $webappname -ResourceType Microsoft.Web/sites/sourcecontrols/web -ResourceGroupName $resourceGroupName -ApiVersion 2015-08-01-preview

这正是我想要的(好吧,这和@ukaszKałużny的答案),但既然你先回答了——尽管只需要几分钟!
$webappname = "name of your webapp"
$RepoUrl = "https://github.com/davidebbo-test/Mvc52Application.git"
$branch = "master"
$location = "location of your webapp "
$resourceGroupName = "name of resource group with your webapp"
New-AzureRmResource -Location $location -Properties @{"RepoUrl"="$RepoUrl";"branch"="$branch";"IsManualIntegration"="true"} -ResourceName $webappname -ResourceType Microsoft.Web/sites/sourcecontrols/web -ResourceGroupName $resourceGroupName -ApiVersion 2015-08-01-preview