通过powershell创建azure webjob出错

Error in creating azure webjob through powershell

我按照以下命令通过 powershell 创建了一个 azure webjob link Create a Scheduled Azure WebJob with PowerShell

Webjob 在提到的 webapp 中成功创建,但是当我尝试启动 web 作业时抛出以下异常

System.AggregateException: One or more errors occurredMicrosoft.WindowsAzure.Storage.StorageException: The remote server returned an error: (403) Forbidden. System.Net.WebException: The remote server returned an error: (403) Forbidden.

Microsoft.WindowsAzure.Storage.Shared.Protocol.HttpResponseParsers.ProcessExpectedStatusCodeNoException[T](HttpStatusCode expectedStatusCode, HttpStatusCode actualStatusCode, T retVal, StorageCommandBase`1 cmd, Exception ex)

我在 webjob 中访问一个存储帐户,当我通过 visual studio 部署时它运行良好,只有在使用 Powershell cmdlet 时才会出现问题。

Web 作业访问的存储帐户与其托管的存储帐户处于不同的订阅中,因此出现错误 403,我将存储帐户的订阅更改为与 Web 作业相同的订阅,并且工作正常。