Skip to content

Commit b032ff8

Browse files
Change use of DefaultAzureCredential to ManagedIdentityCredential for Azure Log Analytics (#2811)
## Why make this change? - It resolves issue #2810 `ManagedIdentityCredential` class only authenticates with Azure Managed Identity which makes it a better fit to use in AzureLogAnalytics than `DefaultAzureCredential`. ## What is this change? We stop using the `DefaultAzureCredential` class and instead start using the `ManagedIdentityCredential` class. Important Note: As of this moment with this change, the Azure Log Analytics feature can only authenticate against system-assigned identities. ## How was this tested? - [ ] Integration Tests - [ ] Unit Tests - [X] Manual Tests This change cannot be directly tested in the pipeline so it was tested by using a VM and ensuring the logs are correctly sent to Azure Log Analytics table. - See #2787 for more information on how this was set up. ## Sample Request(s) <img width="1028" height="448" alt="image" src="https://github.com/user-attachments/assets/67221e39-4114-4fc2-ba72-1df3ed120b16" />
1 parent 2885360 commit b032ff8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Service/Startup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public void ConfigureServices(IServiceCollection services)
185185
services.AddSingleton(sp =>
186186
{
187187
AzureLogAnalyticsOptions options = runtimeConfig.Runtime.Telemetry.AzureLogAnalytics;
188-
DefaultAzureCredential credential = new();
188+
ManagedIdentityCredential credential = new();
189189
LogsIngestionClient logsIngestionClient = new(new Uri(options.Auth!.DceEndpoint!), credential);
190190
return new AzureLogAnalyticsFlusherService(options, CustomLogCollector, logsIngestionClient, _logger);
191191
});

0 commit comments

Comments
 (0)