【发布时间】:2014-10-16 01:28:12
【问题描述】:
我正在通过源代码控制部署到 Microsoft Azure 网站。登录 Azure 门户并单击 UI 以查看部署历史记录很痛苦。我们可以从命令行或 PowerShell 管理部署吗?
【问题讨论】:
标签: azure-web-app-service azure-powershell azure-cli
我正在通过源代码控制部署到 Microsoft Azure 网站。登录 Azure 门户并单击 UI 以查看部署历史记录很痛苦。我们可以从命令行或 PowerShell 管理部署吗?
【问题讨论】:
标签: azure-web-app-service azure-powershell azure-cli
是的,您可以同时使用 PowerShell 或 xplat(命令行)工具来执行此操作。
有关在此处安装它们的更多信息:
对于 xplat 使用:
azure config mode 'asm'
site deployment list [options] [name]
site deployment show [options] <commitId> [name]
site deployment redeploy [options] <commitId> [name]
site deployment github [options] [name]
对于 PowerShell:
Get-AzureWebsiteDeployment [[-CommitId] <String>] [[-MaxResults] <Int32>] [-Details] [[-Name] <String>] [-Slot <String>] [<CommonParameters>]`
Get-AzureWebsiteDeployment -Name mySite
您还可以浏览到 https://{sitename}.scm.azurewebsites.net,在那里您还可以使用 REST API 查看您的部署。
【讨论】:
适用于 Web 应用程序的 Azure CLI。我们发现传统的 Azure 服务管理器模式最容易做到这一点。此外,我们发现 JSON 中的输出更具可读性。使用--max 会限制结果。
azure config mode asm
azure site deployment list MySiteName --max 1 --json
Azure CLI for Web App Slots。我们还可以检索特定的--slot。
azure config mode asm
azure site deployment list MySiteName --slot MySlotName --max 1 --json
【讨论】: