or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/azure-servicebus@7.14.x
tile.json

tessl/pypi-azure-servicebus

tessl install tessl/pypi-azure-servicebus@7.14.0

Microsoft Azure Service Bus Client Library for Python providing comprehensive messaging capabilities for enterprise applications.

Agent Success

Agent success rate when using this tile

92%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.01x

Baseline

Agent success rate without this tile

91%

task.mdevals/scenario-6/

Service Bus Client Authentication Manager

Build a service to manage Azure Service Bus client connections using multiple authentication methods.

Requirements

Create a module that provides authenticated Service Bus client instances. The module should support creating clients using different credential types and return properly initialized ServiceBusClient instances ready for messaging operations.

Authentication Support

Your module must support creating Service Bus clients using three authentication methods:

  1. SAS Token Authentication: Using a Shared Access Signature with key name and key value
  2. Azure Active Directory Authentication: Using Azure Identity credentials (such as DefaultAzureCredential)
  3. Named Key Authentication: Using a named key credential with policy name and key

Client Creation

Implement functions that:

  • Accept the fully qualified namespace (e.g., "myservicebus.servicebus.windows.net")
  • Accept appropriate credential information based on the authentication method
  • Return a properly configured ServiceBusClient instance
  • Support context manager protocol for resource cleanup

Test Cases

Your implementation should handle these scenarios:

  • Creates a ServiceBusClient using SAS credentials with namespace, key name, and key value @test
  • Creates a ServiceBusClient using Azure AD credentials with namespace and a TokenCredential @test
  • Creates a ServiceBusClient using named key credentials with namespace, policy name, and key @test
  • ServiceBusClient instances can be used as context managers @test

Implementation

@generates

API

from azure.servicebus import ServiceBusClient
from azure.core.credentials import TokenCredential, AzureSasCredential, AzureNamedKeyCredential

def create_client_with_sas(
    fully_qualified_namespace: str,
    shared_access_key_name: str,
    shared_access_key: str
) -> ServiceBusClient:
    """
    Create a ServiceBusClient using SAS (Shared Access Signature) authentication.

    Args:
        fully_qualified_namespace: The Service Bus namespace (e.g., 'mybus.servicebus.windows.net')
        shared_access_key_name: The name of the shared access key
        shared_access_key: The shared access key value

    Returns:
        A ServiceBusClient instance authenticated with SAS credentials
    """
    pass

def create_client_with_aad(
    fully_qualified_namespace: str,
    credential: TokenCredential
) -> ServiceBusClient:
    """
    Create a ServiceBusClient using Azure Active Directory authentication.

    Args:
        fully_qualified_namespace: The Service Bus namespace (e.g., 'mybus.servicebus.windows.net')
        credential: A TokenCredential instance (e.g., DefaultAzureCredential)

    Returns:
        A ServiceBusClient instance authenticated with Azure AD credentials
    """
    pass

def create_client_with_named_key(
    fully_qualified_namespace: str,
    policy_name: str,
    key: str
) -> ServiceBusClient:
    """
    Create a ServiceBusClient using named key authentication.

    Args:
        fully_qualified_namespace: The Service Bus namespace (e.g., 'mybus.servicebus.windows.net')
        policy_name: The name of the shared access policy
        key: The key associated with the policy

    Returns:
        A ServiceBusClient instance authenticated with named key credentials
    """
    pass

Dependencies { .dependencies }

azure-servicebus { .dependency }

Provides Azure Service Bus messaging client capabilities including authentication and connection management.

@satisfied-by

azure-core { .dependency }

Provides core credential types for Azure authentication.

@satisfied-by