Simple snippet to download Log Analytics data.
Register application that should have Reader priveleges for Log Analytics. Use ClientId and ClientSecret from this application to access data. Connect Configuration Manager to Log Analytics
Use code bellow to request all records that contain COUNTER tracking
var client = new LogAnalyticsDownloader(...);
var parameters = new SearchParaeters();
parameters.Query = "COUNTER tracking";
parameters.Start = date;
parameters.End = date.AddDays(1).AddMilliseconds(-1);
var data = await client.DownloadAsync(parameters);
- Limitation in 5000 records
- whole class hierarchy should be reviewed. Current code is a part of small utility that give us ability to create daily report in Confluence.