Azure 应用服务管理任务

Azure DevOps Services

此任务用于启动、停止、重启、槽交换、与预览版交换、安装站点扩展或启用对 Azure 应用服务。

YAML 代码片段

# Azure App Service manage
# Start, stop, restart, slot swap, slot delete, install site extensions or enable continuous monitoring for an Azure App Service
- task: AzureAppServiceManage@0
  inputs:
    azureSubscription: 
    #action: 'Swap Slots' # Optional. Options: Swap Slots, Start Swap With Preview, Complete Swap, Cancel Swap, Start Azure App Service, Stop Azure App Service, Restart Azure App Service, Delete Slot, Install Extensions, Enable Continuous Monitoring, Start all continuous webjobs, Stop all continuous webjobs
    webAppName: 
    #specifySlotOrASE: false # Optional
    #resourceGroupName: # Required when action == Swap Slots || Action == Delete Slot || SpecifySlot == True
    #sourceSlot: # Required when action == Swap Slots
    #swapWithProduction: true # Optional
    #targetSlot: # Required when action == Swap Slots && SwapWithProduction == False
    #preserveVnet: false # Optional
    #slot: 'production' # Required when action == Delete Slot || SpecifySlot == True
    #extensionsList: # Required when action == Install Extensions
    #outputVariable: # Optional
    #appInsightsResourceGroupName: # Required when action == Enable Continuous Monitoring
    #applicationInsightsResourceName: # Required when action == Enable Continuous Monitoring
    #applicationInsightsWebTestName: # Optional

参数

参数 描述
ConnectedServiceName
Azure 订阅
(必需) 选择 Azure 资源管理器 订阅
参数别名: azureSubscription
Action
操作
(对) 执行可选操作App 服务。 可以启动、停止、重启、槽交换、使用预览版开始交换、使用预览版完成交换、取消带预览的交换、安装站点扩展或为客户端启用Azure 应用服务
默认值:30Swap Slots
WebAppName
应用服务名称
(必需) 输入或选择现有名称Azure 应用服务
SpecifySlot
指定槽或应用服务环境
(可选) 未定义
ResourceGroupName
资源组
(必需) 输入或选择包含上面指定的Azure 应用服务的 Azure 资源组
SourceSlot
源槽
(时) 用作源槽的必需项 action == Swap Slots。 交换操作将目标槽的流量引导到源槽。
SwapWithProduction
与生产交换
(可选) 选择选项以将源槽的流量与生产槽交换。 如果未选择此选项,则必须提供源槽和目标槽名称。
默认值:30true
TargetSlot
目标槽
(时) 用作目标槽的必需项 action == Swap Slots。 交换操作将目标槽的流量引导到源槽。
PreserveVnet
保留 Vnet
(可选) 交换操作会使用源覆盖目标槽的网络配置
默认值:30false
Slot
槽位
(必需)
默认值:30production
ExtensionsList
安装扩展
(在) 运行所需的站点扩展Microsoft Azure App 服务。 可以安装一组工具作为站点扩展,并更好地管理Azure 应用服务。 将App 服务,以确保最新更改生效。
OutputVariable
输出变量
(可选) 为所选扩展的本地安装路径提供变量名称。此字段现已弃用,将被删除。 在后续任务中,使用"输出变量"部分中的 LocalPathsForInstalledExtensions 变量。
AppInsightsResourceGroupName
Application Insights 的资源组名称
(必填) 输入或选择 Application Insights 资源可用的资源组
ApplicationInsightsResourceName
Application Insights 资源名称
(必需) 选择Insights将记录连续监视数据的应用程序资源。 如果此处未列出 Application Insights 资源,并且想要创建新资源,请单击 [+新建] 按钮。 在 Azure 门户 创建资源后,请返回此处并单击"刷新"按钮。
ApplicationInsightsWebTestName
应用程序Insights Web 测试名称
(可选) 输入Insights或更新的 Web 测试名称。 如果未提供,则使用默认测试名称。

交换期间发生的情况

将两个槽 (通常从过渡槽交换到生产槽) 时,请确保生产槽始终是目标槽。 这样,交换操作才不会影响生产应用。

此外,在交换操作 (交换时,) 交换应用的所有工作都发生在源槽上。 准备和预热源槽时,目标槽将保持联机,而不管交换是成功还是失败。 有关更多详细信息,请参阅在 Azure 应用服务 设置过渡环境。

开源

此任务开放源代码上GitHub。 欢迎提供反馈和建议。