public static async Task <string> AdxExportStatusCheck( [ActivityTrigger] string operationId, ILogger log) { using (var client = KustoClientFactory.CreateCslAdminProvider(await GetKustoConnectionStringBuilder())) { var operationQuery = CslCommandGenerator.GenerateOperationsShowCommand(Guid.Parse(operationId)); var resultReader = new ObjectReader <OperationsShowCommandResult>(client.ExecuteControlCommand(adxDatabaseName, operationQuery)); var res = resultReader?.FirstOrDefault(); var state = res?.State; if (state == "Completed") { // When the state is completed, we can query the export details which contains the path to the file on blob storage var operationDetailsQuery = CslCommandGenerator.GenerateOperationDetailsShowCommand(Guid.Parse(operationId)); var resultReader2 = new ObjectReader <DataExportToBlobCommandResult>(client.ExecuteControlCommand(adxDatabaseName, operationDetailsQuery)); var res2 = resultReader2?.FirstOrDefault(); var path = res2?.Path; return(path); } else if (state == "Cancelled") { return("Error"); } else { return(null); } } }