public bool Connect() { if (_config.LogAnalyticsCreate | _config.LogAnalyticsRecreate | _config.Unique) { Authenticate(); GetCurrentWorkspace(); if (_config.LogAnalyticsRecreate) { return(RecreateWorkspace()); } if (_config.LogAnalyticsCreate) { return(CreateWorkspace()); } if (_config.Unique) { List <string> existingUploads = PostQueryList($"['{_config.LogAnalyticsName}_CL']|distinct RelativeUri_s", false).Select(x => x = Path.GetFileNameWithoutExtension(x)).ToList(); Log.Info($"listResults:", existingUploads); foreach (string existingUpload in existingUploads) { _instance.FileObjects.Add(new FileObject(existingUpload) { Status = FileStatus.existing }); } } } // send empty object to check connection FileObject fileObject = new FileObject(); fileObject.Stream.Set(Encoding.UTF8.GetBytes("{}")); Log.Info($"Checking connection to log analytics workspace {_config.LogAnalyticsId} ", ConsoleColor.Green); if (!PostData(fileObject, true)) { return(false); } if (_config.IsLogAnalyticsPurgeRequested()) { _arm.Authenticate(); Purge(); return(false); } return(true); }