0
votes

When I try to run my WebJob, I get the following failure:

[07/12/2018 18:09:21 > 7351a7: ERR ] Unhandled Exception: Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException: Error indexing method 'Foo.Bar' ---> System.InvalidOperationException: Invalid storage account 'storage'. Please make sure your credentials are correct. ---> Microsoft.WindowsAzure.Storage.StorageException: The remote server returned an error: (403) Forbidden. ---> System.Net.WebException: The remote server returned an error: (403) Forbidden.
[07/12/2018 18:09:21 > 7351a7: ERR ]    at Microsoft.WindowsAzure.Storage.Shared.Protocol.HttpResponseParsers.ProcessExpectedStatusCodeNoException[T](HttpStatusCode expectedStatusCode, HttpStatusCode actualStatusCode, T retVal, StorageCommandBase`1 cmd, Exception ex)
[07/12/2018 18:09:21 > 7351a7: ERR ]    at Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient.b__19(RESTCommand`1 cmd, HttpWebResponse resp, Exception ex, OperationContext ctx)
[07/12/2018 18:09:21 > 7351a7: ERR ]    at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndGetResponse[T](IAsyncResult getResponseResult)
[07/12/2018 18:09:21 > 7351a7: ERR ]    --- End of inner exception stack trace ---
[07/12/2018 18:09:21 > 7351a7: ERR ]    at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndExecuteAsync[T](IAsyncResult result)
[07/12/2018 18:09:21 > 7351a7: ERR ]    at Microsoft.WindowsAzure.Storage.Core.Util.AsyncExtensions.c__DisplayClass2`1.b__0(IAsyncResult ar)
[07/12/2018 18:09:21 > 7351a7: ERR ] --- End of stack trace from previous location where exception was thrown ---
[07/12/2018 18:09:21 > 7351a7: ERR ]    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
[07/12/2018 18:09:21 > 7351a7: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[07/12/2018 18:09:21 > 7351a7: ERR ]    at Microsoft.Azure.WebJobs.Host.Executors.DefaultStorageCredentialsValidator.d__1.MoveNext()
[07/12/2018 18:09:21 > 7351a7: ERR ]    --- End of inner exception stack trace ---
[07/12/2018 18:09:21 > 7351a7: ERR ]    at Microsoft.Azure.WebJobs.Host.Executors.DefaultStorageCredentialsValidator.d__1.MoveNext()
[07/12/2018 18:09:21 > 7351a7: ERR ] --- End of stack trace from previous location where exception was thrown ---
[07/12/2018 18:09:21 > 7351a7: ERR ]    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
[07/12/2018 18:09:21 > 7351a7: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[07/12/2018 18:09:21 > 7351a7: ERR ]    at Microsoft.Azure.WebJobs.Host.Executors.DefaultStorageCredentialsValidator.d__0.MoveNext()
[07/12/2018 18:09:21 > 7351a7: ERR ] --- End of stack trace from previous location where exception was thrown ---
[07/12/2018 18:09:21 > 7351a7: ERR ]    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
[07/12/2018 18:09:21 > 7351a7: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[07/12/2018 18:09:21 > 7351a7: ERR ]    at Microsoft.Azure.WebJobs.Host.Executors.DefaultStorageAccountProvider.d__24.MoveNext()
[07/12/2018 18:09:21 > 7351a7: ERR ] --- End of stack trace from previous location where exception was thrown ---
[07/12/2018 18:09:21 > 7351a7: ERR ]    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
[07/12/2018 18:09:21 > 7351a7: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[07/12/2018 18:09:21 > 7351a7: WARN] Reached maximum allowed output lines for this run, to see all of the job's logs you can enable website application diagnostics
[07/12/2018 18:09:21 > 7351a7: SYS ERR ] Job failed due to exit code -532462766
[07/12/2018 18:09:21 > 7351a7: SYS INFO] Process went down, waiting for 60 seconds

I have 100% validated that my storage account credentials are correct.

When I attempt to manually connect to the storage account and invoke CreateifNotExist, I get:

[07/12/2018 18:11:46 > 7351a7: INFO]       Microsoft.WindowsAzure.Storage.StorageException: The remote server returned an error: (403) Forbidden. ---> System.Net.WebException: The remote server returned an error: (403) Forbidden.
[07/12/2018 18:11:46 > 7351a7: INFO]          at System.Net.HttpWebRequest.GetResponse()
[07/12/2018 18:11:46 > 7351a7: INFO]          at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)
[07/12/2018 18:11:46 > 7351a7: INFO]          --- End of inner exception stack trace ---
[07/12/2018 18:11:46 > 7351a7: INFO]          at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)
[07/12/2018 18:11:46 > 7351a7: INFO]          at Microsoft.WindowsAzure.Storage.Queue.CloudQueue.CreateIfNotExists(QueueRequestOptions options, OperationContext operationContext)

Upon dumping additional information about the exception from Microsoft.WindowsAzure.Storage.StorageExtendedErrorInformation, I see:

AuthenticationErrorDetail:The MAC signature found in the HTTP request 'CUVqVMvvWecPsnTEynjocGpq6TkBmkpJsVL6hr2jkKQ=' is not the same as any computed signature. Server used following string to sign: 'PUT
1
I get this, tooJerry Nixon

1 Answers

0
votes

See the following GitHub issue where ApplicationInsights may be interferring with your HTTP request to the storage REST APIs:

https://github.com/Azure/azure-storage-net/issues/490

Make sure the following is in your applicationinsights.config file:

    <Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector">
      <ExcludeComponentCorrelationHttpHeadersOnDomains>
        <!-- 
        Requests to the following hostnames will not be modified by adding correlation headers.         
        Add entries here to exclude additional hostnames.
        NOTE: this configuration will be lost upon NuGet upgrade.
        -->
        <Add>core.windows.net</Add>
        <Add>core.chinacloudapi.cn</Add>
        <Add>core.cloudapi.de</Add>
        <Add>core.usgovcloudapi.net</Add>
        <Add>localhost</Add>
        <Add>127.0.0.1</Add>
      </ExcludeComponentCorrelationHttpHeadersOnDomains>
      <IncludeDiagnosticSourceActivities>
        <Add>Microsoft.Azure.EventHubs</Add>
        <Add>Microsoft.Azure.ServiceBus</Add>
      </IncludeDiagnosticSourceActivities>
    </Add>