Can a Azure LogicApps stop a webjob?

旧时模样 提交于 2019-12-11 14:40:10

问题


Azure LogicApps time! In my previous post my problem was to understand how to run a webjob. My problem is: how can I stop a webjob?

In another posts in Stackoverflow, people send a DELETE request to stop a webjob like

$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" 

I sent just a DELETE request and the webjob disappeared. Basically, it was deleted.


回答1:


You still could use HTTP trigger or action to request a Post action. But You need to pay attention to one thing, the Webjob API only support to stop continuous Webjob. So if yours is continuous, you could achieve your purpose.

And this is my test pic.

And the WebJob API still support other request action, about details you could refer to this wiki.

Hope this could help you, if you still have other questions, please let me know.




回答2:


You can disable/enable a Logic App with 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



回答3:


Yes, you should be able to use the Azure Resource Manager connector, and "Invoke resource operation` operation to stop a webjob.



来源:https://stackoverflow.com/questions/54186509/can-a-azure-logicapps-stop-a-webjob

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!