简体   繁体   中英

Run Azure Webjob by URL

I have a webjob hosted on Azure. the webjob we be run on demand. I have a person (different department/ different company) whenever he wants this webjob to be run, he have to run it. but without accessing the azure website, we are not allowed to give him access to azure.

so I am thinking in a way, if there is some URL if he accessed it, the webjob will start running directly. otherwise, this person will be always requesting me to run for him this web job.

and we cannot make it continuously, or scheduled, because some days we do not need it to be run at all, some days we want to run it may be 200 times. we would never know.

There several ways to run a WebJob OnDemand. However currently all of them require access to the Azure account and/or Web App. If you want to give access to someone to run the job only , then you could create a simple site with UI that lets them invoke the job, where you implement whatever auth scheme you want for the site.

The site implementation can then invoke the job via an HTTP POST request using a specially crafted "trigger URI" as described in this post . As you can see, that URI includes the basic auth credentials for the Web App, so you can't just tell them to invoke that directly.

Another interesting option for you would be to use IFTTT . You can create a simple "recipe" that invokes the job via HTTP POST as above using the "Maker Channel" for the "That" action, but importantly you can then configure the "This" source to be triggered based on many different inputs - eg when an email is sent, or an SMS message, phone call, etc. You could then have it set up so your friend only has to send an email or a text to trigger the job. This way they don't have access to any of your Web App credentials. For yourself, you could also use the IFTTT "Do Button" app on your phone to trigger the job via a button click on your phone!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM