Github源代码如何使用应用服务的部署槽

How to use deployment slots of app services with Github Source code

我正在从 Github 部署我的应用程序,我有三个不同的部署插槽 (Dev/Staging/prod),我想只将代码部署到 Dev 并将部署的代码交换到其余的阶段。

我还没有任何管道工具,所以想通过命令行或 GUI 选项来了解,因为它是概念证明。

您可以使用 Azure CLI 或 powershell 访问它。

Azure CLI:

# Replace the following URL with a public GitHub repo URL
gitrepo=https://github.com/Azure-Samples/php-docs-hello-world
webappname=mywebapp$RANDOM

# Deploy code from a public GitHub repository. 
az webapp deployment source config --name $webappname --resource-group myResourceGroup \
--repo-url $gitrepo --branch master --manual-integration

Azure Powershell:

# Replace the following URL with a public GitHub repo URL
$gitrepo="https://github.com/Azure-Samples/app-service-web-dotnet-get-started.git"
$webappname="mywebapp$(Get-Random)"
$location="West Europe"

# Configure GitHub deployment from your GitHub repo and deploy once.
$PropertiesObject = @{
    repoUrl = "$gitrepo";
    branch = "master";
    isManualIntegration = "true";
}
Set-AzureRmResource -PropertyObject $PropertiesObject -ResourceGroupName myResourceGroup -ResourceType Microsoft.Web/sites/sourcecontrols -ResourceName $webappname/web -ApiVersion 2015-08-01 -Force

将其发布到 Azure 后,您可以 swap the slot via the portal, also the azure Powershell and CLI