azure-sdk-for-net icon indicating copy to clipboard operation
azure-sdk-for-net copied to clipboard

Question about error - The credential provided is not a supported type

Open Vishwak4 opened this issue 2 years ago • 2 comments

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

Vishwak4 avatar Feb 03 '23 18:02 Vishwak4

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?

jsquire avatar Feb 03 '23 21:02 jsquire

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!

ghost avatar Feb 13 '23 20:02 ghost