【发布时间】:2018-06-25 15:22:30
【问题描述】:
我正在从 Github 部署我的应用程序,并且我有三个不同的部署槽(Dev/Staging/prod),并且希望仅将代码部署到 Dev 并将部署的代码交换到其余阶段。
只是我还没有任何管道工具,所以想用命令行或 GUI 选项来理解,因为它是概念证明。
【问题讨论】:
标签: azure azure-app-service-envrmnt
我正在从 Github 部署我的应用程序,并且我有三个不同的部署槽(Dev/Staging/prod),并且希望仅将代码部署到 Dev 并将部署的代码交换到其余阶段。
只是我还没有任何管道工具,所以想用命令行或 GUI 选项来理解,因为它是概念证明。
【问题讨论】:
标签: azure azure-app-service-envrmnt
您可以使用 Azure CLI 或 powershell 来访问它。
# 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
# 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,也可以是 azure Powershell 和 CLI。
【讨论】:
webappname 和你的 Dev slot 名称,slot 就像与 web 应用程序的副本一样,该命令对部署 slot 也有效。