Running Azure PowerShell commands from a webjob

前端 未结 2 700
忘了有多久
忘了有多久 2021-01-19 10:31

Update: I used Azure Automation per BenV\'s suggestion below and it worked! More info can be found here.


I have a PowerShell script that need

相关标签:
2条回答
  • 2021-01-19 11:10

    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...

    0 讨论(0)
  • 2021-01-19 11:16

    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.

    0 讨论(0)
提交回复
热议问题