question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Authorization header issue with Microsoft.ApplicationInsights.AspNetCore v2.1.0

See original GitHub issue

I’m trying to setup a simple Blob storage backend following the guide here: https://docs.microsoft.com/en-us/azure/storage/vs-storage-aspnet5-getting-started-blobs

Here’s my current code:

cloudStorageAccount = CloudStorageAccount.Parse("UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://ipv4.fiddler");
blobClient = cloudStorageAccount.CreateCloudBlobClient();
blobContainer = blobClient.GetContainerReference("data");
            
await blobContainer.CreateIfNotExistsAsync(); // StorageException here

Here’s the request as captured by Fiddler:

PUT http://127.0.0.1:10000/devstoreaccount1/data?restype=container HTTP/1.1
Connection: Keep-Alive
Authorization: SharedKey devstoreaccount1:BUb0duyrg8SKj7MARfsml+G1yLQ+wIx0MMdpIi/zuKg=
User-Agent: Azure-Storage/8.1.4 (.NET Core)
x-ms-client-request-id: 929c480d-926c-493e-9455-671d52349983
x-ms-version: 2016-05-31
x-ms-date: Wed, 05 Jul 2017 17:03:59 GMT
x-ms-request-root-id: a827f7ed-479f851154b64889
x-ms-request-id: |a827f7ed-479f851154b64889.1.
Request-Id: |a827f7ed-479f851154b64889.1.
Content-Length: 0
Host: 127.0.0.1:10000

Response:

HTTP/1.1 403 Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
Content-Length: 839
Content-Type: application/xml
Server: Microsoft-HTTPAPI/2.0
x-ms-request-id: 72d14368-94cb-4135-b7a1-329e99efabb6
Date: Wed, 05 Jul 2017 17:04:01 GMT

<?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:72d14368-94cb-4135-b7a1-329e99efabb6
Time:2017-07-05T17:04:01.4550192Z</Message><AuthenticationErrorDetail>The MAC signature found in the HTTP request 'BUb0duyrg8SKj7MARfsml+G1yLQ+wIx0MMdpIi/zuKg=' is not the same as any computed signature. Server used following string to sign: 'PUT











x-ms-client-request-id:929c480d-926c-493e-9455-671d52349983
x-ms-date:Wed, 05 Jul 2017 17:03:59 GMT
x-ms-request-id:|a827f7ed-479f851154b64889.1.
x-ms-request-root-id:a827f7ed-479f851154b64889
x-ms-version:2016-05-31
/devstoreaccount1/devstoreaccount1/data
restype:container'.</AuthenticationErrorDetail></Error>

Emulator status:

C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>AzureStorageEmulator.exe status
Windows Azure Storage Emulator 5.1.0.0 command line tool
IsRunning: True
BlobEndpoint: http://127.0.0.1:10000/
QueueEndpoint: http://127.0.0.1:10001/
TableEndpoint: http://127.0.0.1:10002/

I’ve been trying to look for a way to get the version of the string to sign used by the client library, but all the guides I’ve found are for .NET Framework (and not Core). (e.g. https://docs.microsoft.com/en-us/rest/api/storageservices/client-side-logging-with-the-.net-storage-client-library and “The TraceSource provider” at https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging#built-in-logging-providers)

Any ideas on what to try next? Is logging available on a .NET Core project?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
contactsamiecommented, Sep 15, 2017

@cijothomas Yes it worked like a charm after i added those! Awesome, thank you so much

1reaction
cijothomascommented, Sep 14, 2017

@contactsamie Can you check applicationinsights.config file to verify that the following section exists? <Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector"> <ExcludeComponentCorrelationHttpHeadersOnDomains> <Add>core.windows.net</Add> <Add>core.chinacloudapi.cn</Add> <Add>core.cloudapi.de</Add> <Add>core.usgovcloudapi.net</Add> </ExcludeComponentCorrelationHttpHeadersOnDomains> </Add>

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configure Application Insights for your ASP.NET website
This procedure configures your ASP.NET web app to send telemetry to the Application Insights feature of the Azure Monitor service.
Read more >
Azure Application Insights Agent troubleshooting and ...
This article provides troubleshooting information to help resolve data collection issues you might experience when Application Insights ...
Read more >
Authorization Error when Sending Telemetry to Azure ...
I have encountered an issue when the local authentication in Azure application insights is disabled, leading to problems with logging telemetry ...
Read more >
Upgrading to ASP.NET Core 2.0 - Code with Steve
Documenting my experiences with upgrading a real-world ASP.NET Core 1.0 project to ASP.NET Core 2.0 and .NET Core 2.0.
Read more >
Application Insights for ASP.NET Core applications
Monitor ASP.NET Core web applications for availability, performance, and usage.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found