Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ internal static TokenCredential CreateCredential(IConfiguration configuration)
return new WorkloadIdentityCredential(workloadIdentityOptions);
}

throw new ArgumentException("For workload identity, 'tenantId', 'clientId', and 'tokenFilePath' must be specified via environment variables or the configuration.");
throw new ArgumentException("For workload identity, 'tenantId', 'clientId', and 'tokenFilePath' must be specified via the configuration.");
}

if (string.Equals(credentialType, "managedidentityasfederatedidentity", StringComparison.OrdinalIgnoreCase))
Expand All @@ -189,7 +189,7 @@ internal static TokenCredential CreateCredential(IConfiguration configuration)
string.IsNullOrWhiteSpace(clientId) ||
string.IsNullOrWhiteSpace(azureCloud))
{
throw new ArgumentException("For managed identity as a federated identity credential, 'tenantId', 'clientId', 'azureCloud', and one of ['managedIdentityClientId', 'resourceId', 'objectId'] must be specified via environment variables or the configuration.");
throw new ArgumentException("For managed identity as a federated identity credential, 'tenantId', 'clientId', 'azureCloud', and one of ['managedIdentityClientId', 'managedIdentityResourceId', 'managedIdentityObjectId'] must be specified via the configuration.");
}

if (!string.IsNullOrWhiteSpace(resourceId))
Expand Down Expand Up @@ -413,8 +413,8 @@ private static void AssertSingleManagedIdentityIdentifier(string clientId, strin
idCount += string.IsNullOrWhiteSpace(objectId) ? 0 : 1;

var validIdentifiers = isFederated
? "'clientId', 'managedIdentityClientId', 'managedIdentityResourceId', or 'managedIdentityObjectId'"
: "'managedIdentityClientId', 'managedIdentityResourceId', or 'managedIdentityObjectId'";
? "'managedIdentityClientId', 'managedIdentityResourceId', or 'managedIdentityObjectId'"
: "'clientId', 'managedIdentityClientId', 'managedIdentityResourceId', or 'managedIdentityObjectId'";

if (idCount > 1)
{
Expand All @@ -423,7 +423,7 @@ private static void AssertSingleManagedIdentityIdentifier(string clientId, strin

if (isFederated && idCount < 1)
{
throw new ArgumentException($"At least one of [{validIdentifiers}] must be specified for managed identity.");
throw new ArgumentException($"A clientId and exactly one of [{validIdentifiers}] must be specified for federated managed identity.");
}
}

Expand Down