问题
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