Skip to content

Commit 7ed60e9

Browse files
committed
Add printing which value is missing for client secret credential
1 parent d0d7791 commit 7ed60e9

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

api/Configurations/CustomServiceConfigurations.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,21 @@ public static TokenCredential CreateCredential(IConfiguration config)
9595
}
9696
else
9797
{
98+
var missing = new List<string>();
99+
if (string.IsNullOrWhiteSpace(tenantId))
100+
missing.Add("tenantId");
101+
if (string.IsNullOrWhiteSpace(clientId))
102+
missing.Add("clientId");
103+
if (
104+
string.IsNullOrWhiteSpace(clientSecret)
105+
|| clientSecret.StartsWith("Fill in", StringComparison.OrdinalIgnoreCase)
106+
)
107+
missing.Add("clientSecret");
108+
98109
Console.WriteLine(
99-
"AzureAd:AllowedAuthMethods includes 'ClientSecret' but tenantId, "
100-
+ "clientId or clientSecret is missing/placeholder; skipping ClientSecretCredential."
110+
$"AzureAd:AllowedAuthMethods includes 'ClientSecret' but "
111+
+ $"{string.Join(", ", missing)} is missing/placeholder; "
112+
+ "skipping ClientSecretCredential."
101113
);
102114
}
103115
}

0 commit comments

Comments
 (0)