简体   繁体   English

按URL运行Azure Webjob

[英]Run Azure Webjob by URL

I have a webjob hosted on Azure. 我在Azure上托管了一个webjob。 the webjob we be run on demand. 我们按需运行webjob。 I have a person (different department/ different company) whenever he wants this webjob to be run, he have to run it. 我有一个人(不同的部门/不同的公司),只要他想要运行这个webjob,他就必须运行它。 but without accessing the azure website, we are not allowed to give him access to azure. 但是如果没有访问azure网站,我们不允许他访问azure。

so I am thinking in a way, if there is some URL if he accessed it, the webjob will start running directly. 所以我想某种方式,如果他访问它有一些URL,webjob将直接开始运行。 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. 我们无法连续或预定,因为有些日子我们根本不需要它运行,有些日子我们想要运行它可能是200次。 we would never know. 我们永远不会知道。

There several ways to run a WebJob OnDemand. 有几种方法可以运行WebJob OnDemand。 However currently all of them require access to the Azure account and/or Web App. 但是,目前所有这些都需要访问Azure帐户和/或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. 如果您想授予某人只能运行作业的访问权限,那么您可以创建一个带有UI的简单站点,让他们可以调用该作业,您可以在其中实现您希望为该站点创建的任何身份验证方案。

The site implementation can then invoke the job via an HTTP POST request using a specially crafted "trigger URI" as described in this post . 然后现场实施可以通过使用特制的“触发URI”中描述的HTTP 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. 如您所见,该URI包含Web App的基本身份验证凭据,因此您不能只是告诉他们直接调用它。

Another interesting option for you would be to use IFTTT . 另一个有趣的选择是使用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. 您可以创建一个简单的“配方”,通过HTTP POST调用作业,如上所述,使用“Maker Channel”进行“That”操作,但重要的是,您可以配置基于许多不同输入触发的“This”源 - 例如,当发送电子邮件,或短信,电话等时,您可以设置它,以便您的朋友只需发送电子邮件或文本来触发工作。 This way they don't have access to any of your Web App credentials. 这样,他们就无法访问您的任何Web App凭据。 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! 对于您自己,您还可以使用手机上的IFTTT“Do Button”应用程序通过手机上的按钮点击来触发工作!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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