Azure Functions "A host error has occurred during startup operation" "Server failed to authenticate the request" "The MAC signature found in the HTTP request is not the same as any computed signature."

Andrew Hawes 171 Reputation points
2022-06-13T21:55:28.523+00:00

I am migrating an Azure Functions application from Runtime v2 to v4 and .NET 6. The functions app includes Durable Functions. Migrating the code was straight forward and I had no issues running locally. However, when I published to production, I started seeing this error. I thought it was related to me also trying to use Managed Identity and Key Vault but I have since taken those elements out and I am still getting the error below.

The error happens immediately during app startup so it seems to not be an issue with the actual functions but in the initial setup connecting to Azure Storage.

I have posted a question in the Azure Functions Host on GitHub but I haven't received much help.
https://github.com/Azure/azure-functions-host/issues/8412

Example Full Error:
[Error] A host error has occurred during startup operation '****************'.Azure.RequestFailedException : Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.RequestId:****************Time:2022-06-13T21:20:40.5617774ZStatus: 403 (Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.)ErrorCode: AuthenticationFailedAdditional Information:AuthenticationErrorDetail: The MAC signature found in the HTTP request '****************' is not the same as any computed signature. Server used following string to sign: 'PUTx-ms-client-request-id:****************x-ms-date:Mon, 13 Jun 2022 21:20:40 GMTx-ms-return-client-request-id:truex-ms-version:2020-08-04/***************/azure-webjobs-secretsrestype:container'.Content:<?xml version="1.0" encoding="utf-8"?><Error><Code>AuthenticationFailed</Code><Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.RequestId:****************000000Time:2022-06-13T21:20:40.5617774Z</Message><AuthenticationErrorDetail>The MAC signature found in the HTTP request '****************' is not the same as any computed signature. Server used following string to sign: 'PUTx-ms-client-request-id:****************x-ms-date:Mon, 13 Jun 2022 21:20:40 GMTx-ms-return-client-request-id:truex-ms-version:2020-08-04/***************/azure-webjobs-secretsrestype:container'.</AuthenticationErrorDetail></Error>Headers:Server: Microsoft-HTTPAPI/2.0x-ms-request-id: ****************000000x-ms-error-code: AuthenticationFailedDate: Mon, 13 Jun 2022 21:20:40 GMTContent-Length: 780Content-Type: application/xmlat Azure.Storage.Blobs.ContainerRestClient.Create(Nullable1 timeout,IDictionary2 metadata,Nullable1 access,String defaultEncryptionScope,Nullable1 preventEncryptionScopeOverride,CancellationToken cancellationToken)at async Azure.Storage.Blobs.BlobContainerClient.CreateInternal(PublicAccessType publicAccessType,IDictionary2 metadata,BlobContainerEncryptionScopeOptions encryptionScopeOptions,Boolean async,CancellationToken cancellationToken,String operationName)at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at async Azure.Storage.Blobs.BlobContainerClient.CreateIfNotExistsInternal(PublicAccessType publicAccessType,IDictionary2 metadata,BlobContainerEncryptionScopeOptions encryptionScopeOptions,Boolean async,CancellationToken cancellationToken)at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at Azure.Storage.Blobs.BlobContainerClient.CreateIfNotExists(PublicAccessType publicAccessType,IDictionary2 metadata,BlobContainerEncryptionScopeOptions encryptionScopeOptions,CancellationToken cancellationToken)at Microsoft.Azure.WebJobs.Script.WebHost.BlobStorageSecretsRepository.CreateBlobContainerClient(String connection) at /_/src/WebJobs.Script.WebHost/Security/KeyManagement/BlobStorageSecretsRepository.cs : 69at async Microsoft.Azure.WebJobs.Script.WebHost.BlobStorageSecretsRepository.ReadAsync(ScriptSecretsType type,String functionName) at /_/src/WebJobs.Script.WebHost/Security/KeyManagement/BlobStorageSecretsRepository.cs : 83at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at async Microsoft.Azure.WebJobs.Script.WebHost.SecretManager.LoadSecretsAsync(??) at /_/src/WebJobs.Script.WebHost/Security/KeyManagement/SecretManager.cs : 393at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at async Microsoft.Azure.WebJobs.Script.WebHost.SecretManager.LoadSecretsAsync[T](??) at /_/src/WebJobs.Script.WebHost/Security/KeyManagement/SecretManager.cs : 386at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at async Microsoft.Azure.WebJobs.Script.WebHost.SecretManager.GetHostSecretsAsync() at /_/src/WebJobs.Script.WebHost/Security/KeyManagement/SecretManager.cs : 93at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at async Microsoft.Azure.WebJobs.Script.WebHost.DefaultScriptWebHookProvider.GetOrCreateExtensionKey(String extensionName) at /_/src/WebJobs.Script.WebHost/WebHooks/DefaultScriptWebHookProvider.cs : 75at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at Microsoft.Azure.WebJobs.Script.WebHost.DefaultScriptWebHookProvider.GetExtensionWebHookRoute(String extensionName) at /_/src/WebJobs.Script.WebHost/WebHooks/DefaultScriptWebHookProvider.cs : 67at Microsoft.Azure.WebJobs.Script.WebHost.DefaultScriptWebHookProvider.GetUrl(IExtensionConfigProvider extension) at /_/src/WebJobs.Script.WebHost/WebHooks/DefaultScriptWebHookProvider.cs : 52at Microsoft.Azure.WebJobs.Host.Config.ExtensionConfigContext.GetWebhookHandler() at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Config\ExtensionConfigContext.cs : 55at Microsoft.Azure.WebJobs.Extensions.DurableTask.DurableTaskExtension.Microsoft.Azure.WebJobs.Host.Config.IExtensionConfigProvider.Initialize(ExtensionConfigContext context) at D:\a\_work\1\s\src\WebJobs.Extensions.DurableTask\DurableTaskExtension.cs : 360at Microsoft.Azure.WebJobs.Host.DefaultExtensionRegistryFactory.Create() at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\DefaultExtensionRegistryFactory.cs : 38at Microsoft.Azure.WebJobs.WebJobsServiceCollectionExtensions.<>c.<AddWebJobs>b__2_0(IServiceProvider p) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Hosting\WebJobsServiceCollectionExtensions.cs : 57at DryIoc.Microsoft.DependencyInjection.DryIocAdapter.<>c__DisplayClass3_0.<RegisterDescriptor>b__0(IResolverContext r) at /_/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/DryIocAdapter.cs : 162at DryIoc.Registrator.<>c__DisplayClass27_0.<RegisterDelegate>b__0(IResolverContext r) at /_/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 4550at System.Linq.Expressions.Interpreter.FuncCallInstruction3.Run(InterpretedFrame frame)at System.Linq.Expressions.Interpreter.Interpreter.Run(InterpretedFrame frame)at System.Linq.Expressions.Interpreter.LightLambda.Run(Object[] arguments)at System.Dynamic.Utils.DelegateHelpers.FuncThunk1[T1,TReturn](Func2 handler,T1 t1)at DryIoc.Factory.<>c__DisplayClass26_0.<ApplyReuse>b__2() at /_/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 6605at DryIoc.Scope.TryGetOrAdd(ImMap1 items,Int32 id,CreateScopedValue createValue,Int32 disposalOrder) at //src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 7849at DryIoc.Scope.GetOrAdd(Int32 id,CreateScopedValue createValue,Int32 disposalOrder) at //src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 7834at DryIoc.Factory.ApplyReuse(Expression serviceExpr,Request request) at //src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 6604at DryIoc.Factory.GetExpressionOrDefault(Request request) at //src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 6564at DryIoc.Factory.GetDelegateOrDefault(Request request) at //src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 6634at DryIoc.DelegateFactory.GetDelegateOrDefault(Request request) at //src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 7740at DryIoc.Container.DryIoc.IResolver.Resolve(Type serviceType,Object serviceKey,IfUnresolved ifUnresolved,Type requiredServiceType,Request preResolveParent,Object[] args) at //src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 290at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(Exception source)at System.Linq.Expressions.Interpreter.ExceptionHelpers.UnwrapAndRethrow(TargetInvocationException exception)at System.Linq.Expressions.Interpreter.MethodInfoCallInstruction.Run(InterpretedFrame frame)at System.Linq.Expressions.Interpreter.Interpreter.Run(InterpretedFrame frame)at System.Linq.Expressions.Interpreter.LightLambda.Run(Object[] arguments)at System.Dynamic.Utils.DelegateHelpers.FuncThunk1[T1,TReturn](Func2 handler,T1 t1)at DryIoc.Factory.<>c__DisplayClass26_0.<ApplyReuse>b__2() at /_/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 6605at DryIoc.Scope.TryGetOrAdd(ImMap1 items,Int32 id,CreateScopedValue createValue,Int32 disposalOrder) at //src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 7849at DryIoc.Scope.GetOrAdd(Int32 id,CreateScopedValue createValue,Int32 disposalOrder) at //src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 7834at DryIoc.Factory.ApplyReuse(Expression serviceExpr,Request request) at //src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 6604at DryIoc.Factory.GetExpressionOrDefault(Request request) at //src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 6564at DryIoc.Factory.GetDelegateOrDefault(Request request) at //src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 6634at DryIoc.Container.ResolveAndCacheDefaultFactoryDelegate(Type serviceType,IfUnresolved ifUnresolved) at //src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 210at DryIoc.Container.DryIoc.IResolver.Resolve(Type serviceType,IfUnresolved ifUnresolved) at //src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 195at Microsoft.Azure.WebJobs.Script.WebHost.DependencyInjection.JobHostServiceProvider.GetService(Type serviceType,IfUnresolved ifUnresolved) at //src/WebJobs.Script.WebHost/DependencyInjection/JobHostServiceProvider.cs : 99at Microsoft.Azure.WebJobs.Script.WebHost.DependencyInjection.JobHostServiceProvider.GetRequiredService(Type serviceType) at //src/WebJobs.Script.WebHost/DependencyInjection/JobHostServiceProvider.cs : 82at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider,Type serviceType)at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)at Microsoft.Azure.WebJobs.WebJobsServiceCollectionExtensions.<>c.<AddWebJobs>b__2_6(IServiceProvider p) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Hosting\WebJobsServiceCollectionExtensions.cs : 97at DryIoc.Microsoft.DependencyInjection.DryIocAdapter.<>c__DisplayClass3_0.<RegisterDescriptor>b__0(IResolverContext r) at /_/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/DryIocAdapter.cs : 162at DryIoc.Registrator.<>c__DisplayClass27_0.<RegisterDelegate>b__0(IResolverContext r) at /_/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 4550at System.Linq.Expressions.Interpreter.FuncCallInstruction3.Run(InterpretedFrame frame)at System.Linq.Expressions.Interpreter.Interpreter.Run(InterpretedFrame frame)at System.Linq.Expressions.Interpreter.LightLambda.Run(Object[] arguments)at System.Dynamic.Utils.DelegateHelpers.FuncThunk1[T1,TReturn](Func2 handler,T1 t1)at DryIoc.Factory.<>c__DisplayClass26_0.<ApplyReuse>b__2() at /_/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 6605at DryIoc.Scope.TryGetOrAdd(ImMap1 items,Int32 id,CreateScopedValue createValue,Int32 disposalOrder) at /_/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 7849at DryIoc.Scope.GetOrAdd(Int32 id,CreateScopedValue createValue,Int32 disposalOrder) at /_/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 7834at DryIoc.Factory.ApplyReuse(Expression serviceExpr,Request request) at /_/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 6604at DryIoc.Factory.GetExpressionOrDefault(Request request) at /_/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 6564at DryIoc.Factory.GetDelegateOrDefault(Request request) at /_/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 6634at DryIoc.DelegateFactory.GetDelegateOrDefault(Request request) at /_/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 7740at DryIoc.Container.DryIoc.IResolver.Resolve(Type serviceType,Object serviceKey,IfUnresolved ifUnresolved,Type requiredServiceType,Request preResolveParent,Object[] args) at /_/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 290at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(Exception source)at System.Linq.Expressions.Interpreter.ExceptionHelpers.UnwrapAndRethrow(TargetInvocationException exception)at System.Linq.Expressions.Interpreter.MethodInfoCallInstruction.Run(InterpretedFrame frame)at System.Linq.Expressions.Interpreter.Interpreter.Run(InterpretedFrame frame)at System.Linq.Expressions.Interpreter.LightLambda.Run(Object[] arguments)at System.Dynamic.Utils.DelegateHelpers.FuncThunk1[T1,TReturn](Func2 handler,T1 t1)at DryIoc.Factory.<>c__DisplayClass26_0.<ApplyReuse>b__2() at //src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 6605at DryIoc.Scope.TryGetOrAdd(ImMap`1 items,Int32 id,CreateScopedValue createValue,Int32 disposalOrder) at //src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 7849at DryIoc.Scope.GetOrAdd(Int32 id,CreateScopedValue createValue,Int32 disposalOrder) at //src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 7834at DryIoc.Factory.ApplyReuse(Expression serviceExpr,Request request) at //src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 6604at DryIoc.Factory.GetExpressionOrDefault(Request request) at //src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 6564at DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request) at //src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 7083at DryIoc.Factory.GetExpressionOrDefault(Request request) at //src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 6554at DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request) at //src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 7083at DryIoc.Factory.GetExpressionOrDefault(Request request) at //src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 6554at DryIoc.Factory.GetDelegateOrDefault(Request request) at //src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 6634at DryIoc.Container.ResolveAndCacheDefaultFactoryDelegate(Type serviceType,IfUnresolved ifUnresolved) at //src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 210at DryIoc.Container.DryIoc.IResolver.Resolve(Type serviceType,IfUnresolved ifUnresolved) at //src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs : 195at Microsoft.Azure.WebJobs.Script.WebHost.DependencyInjection.JobHostServiceProvider.GetService(Type serviceType,IfUnresolved ifUnresolved) at //src/WebJobs.Script.WebHost/DependencyInjection/JobHostServiceProvider.cs : 99at Microsoft.Azure.WebJobs.Script.WebHost.DependencyInjection.JobHostServiceProvider.GetService(Type serviceType) at //src/WebJobs.Script.WebHost/DependencyInjection/JobHostServiceProvider.cs : 77at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)at async Microsoft.Azure.WebJobs.Script.WebHost.WebJobsScriptHostService.UnsynchronizedStartHostAsync(ScriptHostStartupOperation activeOperation,Int32 attemptCount,JobHostStartupMode startupMode) at /_/src/WebJobs.Script.WebHost/WebJobsScriptHostService.cs : 279

Azure Key Vault
Azure Key Vault
An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
1,126 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,301 questions
{count} votes

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 68,656 Reputation points
    2022-06-16T13:25:59.34+00:00

    @Andrew Hawes Thanks for reaching out. The product team is looking into this and will share an update on your created GitHub issue here.

    3 people found this answer helpful.
    0 comments No comments