Merged PR 97: block net462 and kusto federated authentication without azure client id as it is not supported

block net462 and kusto federated authentication without azure client id as it is not supported
remove runtime property IsARMValid when saving configuration
add additional vscode launch configurations for net462 and net48
This commit is contained in:
Jason Gilbertson 2024-07-23 20:55:09 +00:00
Родитель 5220e35459 b5f1118ef8
Коммит 562c692f14
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,