Running Azure PowerShell commands from a webjob

守給你的承諾、 提交于 2019-12-02 00:23:54

Azure PowerShell is not currently supported from the sandbox in which WebJobs runs. There are a variety of factors:

  1. The CmdLets are not installed on the worker
  2. Even if installed, there are issues that prevent them from running correctly
  3. Even if they run, you'd need to authenticate before running command. This last part is solvable using Service Principals.

Factor #2 is the biggest blocker. We'd like to get to a point where this is possible, but right now it is tricky.

One potential workaround is to do ARM requests directly, though that's a bit more work (and you still need to auth using Service Principal). You could also write C# code to make the calls.

Another possible option might be to use a node script and the azure cli. Alas, I also tried to work around this issue with .sh script but that will fail trying to setup azure cli env (see https://github.com/projectkudu/kudu/issues/1935). Finally, if just storage functions you need might try using SAS tokens and http requests to do basic stuff within your own ps functions...

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