Azure Stop a Triggered Web Job

前端 未结 4 2285
广开言路
广开言路 2021-02-19 17:26

In Azure, Once a Triggered Web Job has begun? What do we need to do - to stop it?

Background:

Our Web Job populates a Service Bus Queue that the

4条回答
  •  情书的邮戳
    2021-02-19 18:02

    as Kobynet explained above we are using the kudu api and we have the following powershell snippet for stopping the proccess

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

提交回复
热议问题