Azure LogicApps 可以停止 Web 作业吗?

Can a Azure LogicApps stop a webjob?

Azure LogicApps时间!在我之前的 中,我的问题是了解如何 运行 a webjob。我的问题是:如何停止 webjob?

在 Whosebug 的另一篇文章中,人们发送了一个 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 请求,webjob 就消失了。基本都删了

您可以 disable/enable 使用 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

是的,您应该能够使用 Azure Resource Manager 连接器和“调用资源操作”操作来停止 Web 作业。

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

这是我的测试照片。

而WebJobAPI仍然支持其他的请求动作,具体可以参考这个wiki.

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