jagilber 2024-07-23 16:55:50 -04:00
Родитель 162a725790 562c692f14
Коммит 2e83fc9f77
3 изменённых файлов: 63 добавлений и 4 удалений

42
.vscode/launch.json поставляемый
Просмотреть файл

@ -4,6 +4,48 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET462 Launch with Args (console)",
"type": "clr",
"request": "launch",
"requireExactSource": false,
"program": "${workspaceFolder}/src/bin/Debug/net462/CollectSFData.exe",
"args": [
//"${input:args}"
"-type",
"trace",
"-krt",
"1",
"-t",
"1",
// "-l",
// "1"
],
"cwd": "${workspaceFolder}/src/bin/Debug/net8.0",
"stopAtEntry": false,
"console": "internalConsole",
},
{
"name": ".NET48 Launch with Args (console)",
"type": "clr",
"request": "launch",
"requireExactSource": false,
"program": "${workspaceFolder}/src/bin/Debug/net48/CollectSFData.exe",
"args": [
//"${input:args}"
"-type",
"trace",
"-krt",
"1",
"-t",
"1",
// "-l",
// "1"
],
"cwd": "${workspaceFolder}/src/bin/Debug/net8.0",
"stopAtEntry": false,
"console": "internalConsole",
},
{
"name": ".NET 8 Launch with Args (console)",
"type": "coreclr",

Просмотреть файл

@ -68,7 +68,7 @@ namespace CollectSFData.Common
}
}
public bool IsARMValid { get; set; }
public bool IsARMValid { get; set; } = false;
public bool IsValid { get; set; }
@ -602,6 +602,7 @@ namespace CollectSFData.Common
options.Remove("Examples");
options.Remove("ExePath");
options.Remove("FileType");
options.Remove("IsARMValid");
options.Remove("IsValid");
options.Remove("NeedsValidation");
options.Remove("SasEndpointInfo");
@ -664,9 +665,13 @@ namespace CollectSFData.Common
retval &= ValidateFileType();
retval &= ValidateTime();
retval &= ValidateSource();
retval &= ValidateDestination();
IsARMValid = ShouldAuthenticateToArm() && (retval &= ValidateAad());
if (ShouldAuthenticateToArm())
{
retval &= IsARMValid = ValidateAad();
}
retval &= ValidateDestination();
if (retval)
{
@ -848,6 +853,16 @@ namespace CollectSFData.Common
retval = false;
}
#if NET462
// if net462, this is not supported and will throw an exception
if (IsKustoConfigured() && !IsARMValid)
{
string errorMessage = "kusto federated security not supported in .net framework 4.6.2. use different framework or configure 'AzureClientId'";
Log.Error(errorMessage);
throw new NotSupportedException(errorMessage);
}
#endif
if (IsKustoConfigured() & IsLogAnalyticsConfigured())
{
Log.Error($"kusto and log analytics *cannot* both be enabled. remove configuration for one");

Просмотреть файл

@ -135,7 +135,9 @@ namespace CollectSFData.Kusto
}
else
{
// use federated security to connect to kusto directly and use kusto identity token instead of arm token
// use kusto federated security to connect to kusto directly and use kusto identity token instead of arm token
Log.Info($"connecting to kusto with kusto federated authentication.");
IngestConnection = new KustoConnectionStringBuilder(ClusterIngestUrl)
{
FederatedSecurity = true,