Azure Service Bus for Python
Practical Python guidance for reliable Azure Service Bus queues and publish-subscribe messaging.
The skill prefers DefaultAzureCredential, discourages keys, and describes part of the authentication flow; however, dependency and permission scope are not detailed, the script permits connection strings, and queue/topic/subscription deletion is exposed without confirmation, rollback, or recovery guidance. DLQ examples also print message bodies, which may expose sensitive data. Trust is therefore deducted for least privilege, sensitive-data handling, external effects, and recovery controls.
The material covers sending, receiving, settlement, sessions, DLQ processing, and administration, but several examples have missing imports, inconsistent environment-variable requirements, and async credentials that are not consistently closed. The script also offers limited structured failure feedback. Repository CI and tests are generic and do not demonstrate this skill's key paths, so static calibration keeps reliability below 10.
Triggers and the Python Service Bus scope are clear, with coverage of synchronous, asynchronous, queue, topic, subscription, and messaging patterns. However, non-fit boundaries, input/output contracts, compatibility guidance, and China-specific Azure environment or mainland-network guidance are absent. Core use depends on reachable Azure services, so points are deducted for boundary precision and environment fit.
The document is layered across installation, authentication, lifecycle, operations, best practices, and reference files, and it declares MIT licensing, author, and version 1.0.0. It lacks a changelog, explicit maintenance owner or update path, pinned dependency guidance, FAQ, and systematic troubleshooting; examples also contain hidden assumptions. Convention is therefore materially but not severely reduced.
The material can directly support common Service Bus sending, receiving, settlement, session, DLQ, and administration tasks, providing clear practical value. Several snippets still require import fixes, API validation, or stronger error handling, and no skill-specific verified outputs or execution evidence are supplied. Static evidence supports a moderate score, not full effectiveness.
The files contain auditable code, configuration examples, references, and repository-level CI/test signals. They do not contain skill-specific test coverage, real execution results, locked dependencies, or corroboration from multiple independent sources. Generic repository tests cannot verify this path's key examples, so verifiability remains limited.
- Add explicit confirmation, least-privilege guidance, and recoverable backup procedures before using the script's delete commands; rollback is currently undocumented.
- Avoid printing message bodies, full exceptions, or application properties in logs and DLQ analysis without redaction.
- Before release, validate imports, SDK APIs, async credential lifecycles, and environment-variable requirements, and add skill-specific CI/tests.
- For mainland-China users, document Azure public-cloud versus China-cloud differences, network reachability, and authentication constraints.
What it does & when to use it
This skill helps Python developers build messaging workflows with the Azure Service Bus SDK. It covers queues, topics, subscriptions, sending and receiving, settlement, sessions, scheduled messages, and dead-letter queues. It includes both synchronous and asynchronous client examples and recommends DefaultAzureCredential with deterministic resource cleanup. It fits Azure applications that need reliable cloud messaging, but it does not provide a complete infrastructure or service-provisioning guide.
Shows how to install azure-servicebus and azure-identity and configure namespace, queue, topic, and subscription environment variables; produces synchronous or asynchronous Python examples using ServiceBusClient, senders, and receivers; demonstrates batch sending, PEEK_LOCK and RECEIVE_AND_DELETE, complete/abandon/dead-letter/defer settlement, topic subscriptions, FIFO sessions, scheduled messages, and dead-letter queue consumption; points to pattern, dead-letter, and setup_servicebus.py reference resources.
- A Python backend developer needs to send and receive business messages through an Azure Service Bus queue.
- An enterprise application needs publish-subscribe delivery through topics and subscriptions.
- A consumer workflow requires lock-based processing with completion, retry, abandonment, and dead-letter handling.
- An order-processing system needs FIFO behavior through Service Bus sessions.
- An Azure project needs batching, scheduled delivery, or dead-letter queue inspection.
Pros & cons
- Covers queues, topics, subscriptions, sessions, batching, scheduling, and dead-letter queues.
- Provides both synchronous and asynchronous Python examples with explicit lifecycle guidance.
- Emphasizes DefaultAzureCredential, production credential constraints, and correct message settlement.
- Focuses on SDK usage rather than complete Azure resource provisioning, networking, or permission-granting procedures.
- Examples assume an existing Service Bus namespace and entities; required environment values must be supplied separately.
- The source provides no dedicated test-suite or test-coverage evidence for this skill.
How to install
Install the repository’s skill collection with npx skills add microsoft/skills, then select the required skill in the wizard. Skills are installed in the selected agent’s directory, such as .github/skills/ for GitHub Copilot. This skill is located at .github/plugins/azure-sdk-python/skills/azure-servicebus-py/. Install its Python packages with pip install azure-servicebus azure-identity.
How to use
Ask a coding agent something like: “Using the Python Azure Service Bus SDK, implement async sending and PEEK_LOCK receiving for an order queue with correct message settlement.” Configure SERVICEBUS_FULLY_QUALIFIED_NAMESPACE and the relevant queue, topic, or subscription variables. Prefer DefaultAzureCredential; use with for synchronous clients and async with for asynchronous clients and async credentials.