403 Forbidden when connecting to Azure Storage with Application Insights Web Tracking HTTP Module
See original GitHub issueCategory
- Question
- Typo
- Bug
- Additional article idea
Expected or Desired Behavior
Connection to Azure Storage should be possible when Application Insights Web Tracking HTTP Module is enabled.
Observed Behavior
Connecting to Azure Storage with Application Insights Web Tracking HTTP Module enabled ends with 403 Forbidden error: “The MAC signature found in the HTTP request is not the same as any computed signature”.
Steps to Reproduce
- Create ASP.NET MVC 5 project.
- Install/update
Microsoft.ApplicationInsights.Web@2.4.0
andWindowsAzure.Storage@8.1.4
from NuGet. - Verify that following entry for ApplicationInsightsWebTracking is present in web.config (configuration/system.webServer/modules):
<remove name="ApplicationInsightsWebTracking" />
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
-
Add following connection string to web.config (configuration/connectionStrings):
<add name="StorageConnectionString" connectionString="UseDevelopmentStorage=true" />
-
Try to create new Azure BLOB Storage container using following code:
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString);
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer container = blobClient.GetContainerReference("mycontainer");
container.CreateIfNotExists();
- Exception is thrown, because Application Insights Web Tracking HTTP Module modifies request’s HTTP Headers after signature generation.
Version
ASP.NET MVC 5 Microsoft.ApplicationInsights.Web@2.4.0 WindowsAzure.Storage@8.1.4 Azure Storage Emulator@5.1
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (1 by maintainers)
Top Results From Across the Web
App insights dependency tracking caused http 403 ...
App insights dependency tracking caused http 403 forbidden error when an app service connects to storage account, need a fix to re-enable tracking....
Read more >Azure Storage C# client returns 403 forbidden in MVC app ...
I'm running into issues using the Azure Storage C# client inside my MVC app, both locally and inside an Azure App Service. I'm...
Read more >Using Application Insights for centralized logging
... where the same problem was explained: 403 Forbidden when connecting to Azure Storage with Application Insights Web Tracking HTTP Module.
Read more >Alerts and Availability Testing :: Application Insights (6 of 6)
Objective This course demonstrates the processes for configuring a web application to use Application Insights for performance tracking, ...
Read more >Azure Storage C# client returns 403 ... - appsloveworld.com
It turns out I'm running into this issue. In my MVC application I'm using Application Insights. In my web.config I have the following...
Read more >Top Related Medium Post
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello we had a the same problem. Get always 403. After debugging for days I found that application insights added headers for the outging requests (because we track dependencies) to BLOB storage. Therefore the computed signature is not the same as the one in the. When I compare ApplicationInsights.config from environments where we don’t have problems I see that we missed this part
<TelemetryModules> <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> <Add>localhost</Add> <Add>127.0.0.1</Add> </ExcludeComponentCorrelationHttpHeadersOnDomains> </Add>
you see core.windows.net is excluded now, after this all worked fine.@phawrylak @cormacpayne not sure how a workaround is being considered a fix. Can resolving this remain an issue and can we expect it to be resolved in future versions? I would hope so.