【问题标题】:Can a Azure LogicApps stop a webjob?Azure LogicApps 可以停止网络作业吗?
【发布时间】:2019-01-14 17:34:14
【问题描述】:

Azure LogicApps时间!在我之前的post 中,我的问题是要了解如何运行webjob。我的问题是:我怎样才能停止webjob?

在 Stackoverflow 的另一个帖子中,人们发送 DELETE 请求以停止类似的网络作业

$username = $website.PublishingUsername
$password = $website.PublishingPassword
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username,$password)))
$ps = Invoke-RestMethod -Uri "$apiBaseUrl/processes" -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -Method GET    
$id = $($ps | where {$_.name -eq $jobname} ).id
Invoke-RestMethod -Uri "$apiBaseUrl/processes/$id" -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -Method DELETE    
write-host "killed process $id" 

我只发送了一个DELETE 请求,网络作业就消失了。基本上都被删了。

【问题讨论】:

标签: azure-webjobs azure-logic-apps


【解决方案1】:

您可以使用 Powershell 禁用/启用逻辑应用:

# Action disable
Invoke-AzureRmResourceAction -ResourceGroupName RESOURCEGROUPNAME -ResourceType Microsoft.Logic/workflows -ResourceName RESOURCENAME -Action disable -ApiVersion 2016-06-01 -Force

# Action enable
Invoke-AzureRmResourceAction -ResourceGroupName RESOURCEGROUPNAME -ResourceType Microsoft.Logic/workflows -ResourceName RESOURCENAME -Action enable -ApiVersion 2016-06-01 -Force

【讨论】:

【解决方案2】:

您仍然可以使用 HTTP 触发器或操作来请求 Post 操作。但是需要注意一件事,Webjob API 只支持停止continuous Webjob。所以如果你的是连续的,你就可以达到你的目的。

这是我的测试照片。

并且WebJob API 还支持其他请求动作,具体可以参考这个wiki。

希望对您有所帮助,如果您还有其他问题,请告诉我。

【讨论】:

    【解决方案3】:

    是的,您应该可以使用Azure Resource Manager 连接器和“调用资源操作”操作来停止网络作业。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-10-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多