saleem-mirza / serilog-sinks-azure-analytics

Serilog sink which writes to Azure analytics
Apache License 2.0
62 stars 45 forks source link

Add support for Azure Token Credentials #87

Closed msimmdev closed 8 months ago

msimmdev commented 9 months ago

I've added support for Azure Token Credentials in options as an alternative to providing a client ID and secret. This allows utilising Azure Managed Identity to connect azure deployed applications as well as other credetnial providers supported in the Azure.Identity library

Example Configuration

    var logger = new LoggerConfiguration()
        .WriteTo.AzureLogAnalytics(
            new LoggerCredential() {
                Endpoint = "*******",
                ImmutableId = "*******",
                StreamName = "*******",
                TokenCredential = new DefaultAzureCredential()
            }, new ConfigurationSettings())
        .CreateLogger();
saleem-mirza commented 8 months ago

Thank you @msimmdev for your contribution. I'll appreciate if you can please update README with example configuration reflecting updates.