azure-sdk-for-net
azure-sdk-for-net copied to clipboard
Question about error - The credential provided is not a supported type
Library name and version
Azure.Messaging.Servicebus version 7.11.1
Query/Question
I am trying to integrate a service with service-bus and while instantiating ServiceBusClient class present in service-bus SDK, I see an error saying "The credential provided is not a supported type.". I want to understand more details about this error. What are the supported credential types? In what cases can we see this error?
The token-credential I am passing is generated using ClientCertificateCredential by passing in a certificate to that.
Stacktrace: System.ArgumentException: The credential provided is not a supported type. Parameter name: credential at Azure.Messaging.ServiceBus.ServiceBusConnection.CreateWithCredential[TCredential](String fullyQualifiedNamespace, TCredential credential, ServiceBusClientOptions options) at Azure.Messaging.ServiceBus.ServiceBusClient..ctor(String fullyQualifiedNamespace, Object credential, ServiceBusClientOptions options) at NotificationServiceClient.QueueClient.SenderStrategy.ServiceBusSenderFactory.CreateSender(String entityName, ClientSettings initConfig)
Code snippet:
var clientCredOption = new ClientCertificateCredentialOptions()
{
AuthorityHost = NotifyEnvironment.GetAADAuthorityHost(environment)
};
TokenCredential token;
var certificate = initConfig.GetAADPrincipalAuthentication().GetClientAuthCertificate();
token = new ClientCertificateCredential(initConfig.GetAADTenantId().ToString(),
initConfig.GetAADPrincipalClientId().ToString(),
certificate,
clientCredOption);
ServiceBusClientOptions serviceBusClientOptions = initConfig.GetServiceBusClientOptions();
var client = new ServiceBusClient(NotifyEnvironment.GetServiceBusEndpoint(primaryRegion, environment), token, serviceBusClientOptions);
Environment
No response
Hi @Vishwak4. Thank you for reaching out and we regret that you're experiencing difficulties. I'm unable to reproduce the error that you're seeing using ClientCertificateCredential with ServiceBusClient nor directly with ServiceBusConnection. I've also verified that our credential-based tests are not experiencing this.
Are you able to package a minimal reproduction that we could use to investigate?
Hi, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!