Can I easily stop/start Azure Webjobs without going through the UI or FTP?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-29 15:01:29

问题


The Azure management interface is abhorrently slow to load up the web jobs list, and the new portal just times out and fails 95% of the time.

We have a lot of WebApps (often deployed per region) in Azure running web jobs. It's extremely cumbersome and slow to have to go through the UI to do all this.

I know that the Kudu API offers start/stop mechanisms for web jobs and you can just drop a file called 'disable.job' in the job folder to stop it, but these all require going through the extremely annoyingly slow UI to download publish credentials ($username, password).

Is there a PowerShell cmdlet I've somehow missed or a public script out there to help do this? Ideally I just want to supply my Azure credentials or import the certificates.

(Honestly, it's rather surprising that Microsoft's key cloud/DevOps product would be almost entirely UI-dependent, and on an extremely slow/useless UI at that.)


回答1:


It's hard to find, but here's a link to the documentation for Start and Stop:

Start: Documentation

Example: Start-AzureWebsiteJob -Name MyWebsite -JobName MyWebJob -JobType Continuous

Stop: Documentation

Example: Stop-AzureWebsiteJob -Name MyWebsite -JobName MyWebJob




回答2:


Al Muhandis,

Actually there is a Rest API that allows to pilot your web jobs.

It allows to list jobs, get a job detail, delete or upoad a job, and some few more,..

Have a look at : https://github.com/projectkudu/kudu/wiki/WebJobs-API

Regards




回答3:


Open your resource, web job at https://resources.azure.com. Should be something like https://resources.azure.com/subscriptions/<your subscription>/resourceGroups/<your group>/providers/Microsoft.Web/sites/<your site name>/continuouswebjobs/<your job name> and open Powershell tab. There should be up to date samples on how to start / stop a WebJob:

# Action start
Invoke-AzureRmResourceAction -ResourceGroupName <your groupname> `
       -ResourceType Microsoft.Web/sites/continuouswebjobs `
       -ResourceName <your site name>/<your job> `
       -Action start  -ApiVersion 2018-02-01 -Force


来源:https://stackoverflow.com/questions/33128432/can-i-easily-stop-start-azure-webjobs-without-going-through-the-ui-or-ftp

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