Aspire.Hosting.Azure.ServiceBus
17.0.0
Prefix Reserved
dotnet add package Aspire.Hosting.Azure.ServiceBus --version 17.0.0
NuGet\Install-Package Aspire.Hosting.Azure.ServiceBus -Version 17.0.0
<PackageReference Include="Aspire.Hosting.Azure.ServiceBus" Version="17.0.0" />
<PackageVersion Include="Aspire.Hosting.Azure.ServiceBus" Version="17.0.0" />
<PackageReference Include="Aspire.Hosting.Azure.ServiceBus" />
paket add Aspire.Hosting.Azure.ServiceBus --version 17.0.0
#r "nuget: Aspire.Hosting.Azure.ServiceBus, 17.0.0"
#:package Aspire.Hosting.Azure.ServiceBus@17.0.0
#addin nuget:?package=Aspire.Hosting.Azure.ServiceBus&version=17.0.0
#tool nuget:?package=Aspire.Hosting.Azure.ServiceBus&version=17.0.0
Azure Service Bus hosting integration
Use this integration to model, configure, and orchestrate Azure Service Bus in an Aspire solution.
Getting started
Prerequisites
- Azure subscription - create one for free
Add the integration
From your AppHost directory, add the Aspire.Hosting.Azure.ServiceBus integration with the Aspire CLI:
aspire add Aspire.Hosting.Azure.ServiceBus
aspire add Aspire.Hosting.Dotnet
Configure Azure Provisioning for local development
Adding Azure resources to the AppHost model will automatically enable development-time provisioning
for Azure resources so that you don't need to configure them manually. Provisioning requires a number of settings
to be available via AppHost configuration. From your AppHost directory, set these values with aspire secret set:
aspire secret set Azure:SubscriptionId "<your subscription id>"
aspire secret set Azure:ResourceGroupPrefix "<prefix for the resource group>"
aspire secret set Azure:Location "<azure location>"
NOTE: Developers must have Owner access to the target subscription so that role assignments can be configured for the provisioned resources.
Usage example
In the AppHost, add a Service Bus connection and reference it from another resource with either C# or TypeScript:
C#
var serviceBus = builder.AddAzureServiceBus("sb");
var myService = builder.AddDotnetProject("myservice", "../MyService/MyService.csproj")
.WithReference(serviceBus);
TypeScript
const serviceBus = await builder.addAzureServiceBus("sb");
const myService = await builder.addNodeApp("myService", "../my-service", "server.js")
.withReference(serviceBus);
Emulator usage
Aspire supports using the Azure Service Bus emulator. To use the emulator, add the following to your AppHost project:
// AppHost
var serviceBus = builder.AddAzureServiceBus("sb").RunAsEmulator();
When the AppHost starts up, a local container running the Azure Service Bus emulator will be started. By default it is accompanied by a SQL Server resource that the emulator uses to store its state, unless an existing SQL Server resource is provided with WithSqlServer (see below). The emulator waits for its SQL Server to become healthy before it starts.
That SQL Server resource can be customized using the regular SQL Server integration APIs, for instance to persist its state in a data volume or use a specific container name:
// AppHost
var serviceBus = builder.AddAzureServiceBus("sb").RunAsEmulator(emulator => emulator
.WithSqlServer(sql => sql
.WithDataVolume()
.WithContainerName("myproject-servicebus-sql")));
Alternatively, the emulator can reuse an existing SQL Server resource instead of creating one for itself:
// AppHost
var sql = builder.AddSqlServer("sql");
var serviceBus = builder.AddAzureServiceBus("sb").RunAsEmulator(emulator => emulator
.WithSqlServer(sql));
NOTE: Customizing the SQL Server resource created for the emulator and reusing an existing one are mutually exclusive and throw an exception when combined.
Connection Properties
When you reference Azure Service Bus resources using WithReference, the following connection properties are made available to the consuming project:
Service Bus namespace
The Service Bus namespace resource exposes the following connection properties:
| Property Name | Description |
|---|---|
Host |
The hostname of the Service Bus namespace |
Port |
The port of the Service Bus namespace when the emulator is used |
Uri |
The connection URI, with the format sb://myservicebus.servicebus.windows.net |
ConnectionString |
Emulator only. Includes SAS key material for the local emulator connection. |
Service Bus queue
The Service Bus queue resource inherits all properties from its parent Service Bus namespace and adds:
| Property Name | Description |
|---|---|
QueueName |
The name of the queue |
Service Bus topic
The Service Bus topic resource inherits all properties from its parent Service Bus namespace and adds:
| Property Name | Description |
|---|---|
TopicName |
The name of the topic |
Service Bus subscription
The Service Bus subscription resource inherits all properties from its parent Service Bus topic and adds:
| Property Name | Description |
|---|---|
SubscriptionName |
The name of the subscription |
ConnectionString |
The connection string for the subscription |
Aspire exposes each property as an environment variable named [RESOURCE]_[PROPERTY]. For instance, the Uri property of a resource called db1 becomes DB1_URI.
Additional documentation
- https://aspire.dev/integrations/gallery/
- https://aspire.dev/integrations/cloud/azure/azure-service-bus/azure-service-bus-host/
- https://learn.microsoft.com/azure/service-bus-messaging/service-bus-messaging-overview
Feedback & contributing
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Aspire.Hosting.Azure (>= 17.0.0)
- Aspire.Hosting.SqlServer (>= 17.0.0)
- AspNetCore.HealthChecks.SqlServer (>= 9.0.0)
- AspNetCore.HealthChecks.Uris (>= 9.0.0)
- Azure.Core (>= 1.63.0)
- Azure.Identity (>= 1.21.0)
- Azure.Provisioning (>= 1.6.0)
- Azure.Provisioning.KeyVault (>= 1.1.0)
- Azure.Provisioning.ServiceBus (>= 1.1.0)
- Azure.ResourceManager.Authorization (>= 1.1.7)
- Azure.ResourceManager.KeyVault (>= 1.4.0)
- Azure.ResourceManager.Resources.Deployments (>= 1.0.0)
- Azure.Security.KeyVault.Secrets (>= 4.11.1)
- Google.Protobuf (>= 3.36.1)
- Grpc.AspNetCore (>= 2.83.0)
- Grpc.Net.ClientFactory (>= 2.83.0)
- Grpc.Tools (>= 2.83.0)
- Hex1b (>= 0.173.0)
- KubernetesClient (>= 19.0.2)
- MessagePack (>= 2.5.307)
- Microsoft.Bcl.Cryptography (>= 10.0.15)
- Microsoft.Data.SqlClient (>= 7.1.1)
- Microsoft.Extensions.Caching.Memory (>= 10.0.15)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.15)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.15)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 10.0.15)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.15)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.15)
- Microsoft.Extensions.FileSystemGlobbing (>= 10.0.15)
- Microsoft.Extensions.Hosting (>= 10.0.15)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.15)
- Microsoft.Extensions.Http (>= 10.0.15)
- Microsoft.Extensions.Logging (>= 10.0.15)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.15)
- Microsoft.Extensions.Options (>= 10.0.15)
- Microsoft.Extensions.Primitives (>= 10.0.15)
- ModelContextProtocol (>= 1.4.1)
- Newtonsoft.Json (>= 13.0.4)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.18.0)
- OpenTelemetry.Extensions.Hosting (>= 1.18.0)
- Polly.Core (>= 8.7.0)
- Semver (>= 3.0.0)
- StreamJsonRpc (>= 2.25.29)
- System.IO.Hashing (>= 10.0.15)
- System.Security.Cryptography.Pkcs (>= 10.0.15)
- YamlDotNet (>= 18.1.0)
NuGet packages (8)
Showing the top 5 NuGet packages that depend on Aspire.Hosting.Azure.ServiceBus:
| Package | Downloads |
|---|---|
|
AJP.Aspire.Hosting.AsbEmulatorUi
A UI for the ASB Emulator, view entities, message counts, send, peek and receive messages, canned Messages, also API for automated testing. |
|
|
SoftwareExtravaganza.Whizbang.Hosting.Azure.ServiceBus
Aspire hosting extensions for Whizbang Azure Service Bus integration |
|
|
Flowly.AzureServiceBus.Aspire
Aspire AppHost integration for Flowly Azure Service Bus. |
|
|
Toxic.Aspire.NamingConventions.Azure
Contains a framework for automatically generating Aspire Azure resource names according to conventions. |
|
|
Aspire.Hosting.Azure.Provisioning.ServiceBus
Opt-in Azure Provisioning Service Bus APIs for polyglot Aspire AppHosts. |
GitHub repositories (3)
Showing the top 3 popular GitHub repositories that depend on Aspire.Hosting.Azure.ServiceBus:
| Repository | Stars |
|---|---|
|
Azure-Samples/eShopOnAzure
A variant of https://github.com/dotnet/eShop that uses Azure services
|
|
|
akkadotnet/Alpakka
Akka Streams Connectors - Alpakka
|
|
|
baotoq/micro-commerce
.NET 10 .NET Aspire
|
| Version | Downloads | Last Updated |
|---|---|---|
| 17.0.0 | 8,525 | 11/18/2026 |
| 13.6.5 | 134,049 | 11/10/2026 |
| 13.6.4 | 121,916 | 10/24/2026 |
| 13.6.3 | 31,764 | 10/21/2026 |
| 13.6.2 | 11,115 | 10/20/2026 |
| 13.6.1 | 170,255 | 10/7/2026 |
| 13.6.0 | 91,019 | 9/29/2026 |
| 13.5.4 | 147,694 | 9/15/2026 |
| 13.5.3 | 191,889 | 8/25/2026 |
| 13.5.2 | 42,778 | 8/21/2026 |
| 13.5.1 | 9,767 | 8/20/2026 |
| 13.5.0 | 17,205 | 8/18/2026 |
| 13.4.6 | 471,502 | 6/19/2026 |
| 13.4.5 | 42,608 | 6/17/2026 |
| 13.4.4 | 39,941 | 6/15/2026 |
| 13.4.3 | 59,392 | 6/8/2026 |
| 13.4.2 | 113,765 | 6/3/2026 |
| 13.4.1 | 2,558 | 6/3/2026 |
| 13.4.0 | 46,653 | 6/1/2026 |
| 13.3.5 | 125,569 | 5/21/2026 |