<commit_before># Azure Service Bus

> [MassTransit.Azure.ServiceBus.Core](https://nuget.org/packages/MassTransit.Azure.ServiceBus.Core/)

The Azure Service Bus transport only supports Standard and Premium tiers of the Microsoft Azure Service Bus service. Premium tier is recommended for production environments.

To configure Azure Service Bus, use the connection string (from the Azure portal) to configure the host as shown below.

<<< @/docs/code/transports/ServiceBusConsoleListener.cs

Additional host properties include:

| Property                |  Description 
|-------------------------|------------------
| TokenProvider         | Use a specific token provider, such as a managed identity token provider, to access the namespace
| TransportType         | Change the transport type from the default (AMQP) to use WebSockets

The following example shows how to configure Azure Service Bus using an Azure Managed Identity:

```csharp
namespace ServiceBusConsoleListener
{
    using System;
    using System.Threading.Tasks;
    using MassTransit;
    using MassTransit.Azure.ServiceBus.Core.Configurators;
    using Microsoft.Azure.ServiceBus.Primitives;
    using Microsoft.Extensions.DependencyInjection;

    public class Program
    {
        public static async Task Main()
        {
            var services = new ServiceCollection();
            services.AddMassTransit(x =>
            {
                x.UsingAzureServiceBus((context, cfg) =>
                {
                    var settings = new HostSettings
                    {
                        ServiceUri = new Uri("sb://your-service-bus-namespace.servicebus.windows.net"/),
                        TokenProvider = TokenProvider.CreateManagedIdentityTokenProvider()
                    };
                    cfg.Host(settings);
                });
            });
        }
    }
}

```

During local development, in the case of Visual Studio, you can configure the account to use under Options -> Azure Service Authentication. Note that your Azure Active Directory user needs explicit access to the resource and have the 'Azure Service Bus Data Owner' role assigned.

Azure Service Bus queues includes an extensive set a properties that can be configured. All of these are optional, MassTransit uses sensible defaults, but the control is there when needed.<commit_msg>Update ASB MSI Docs<commit_after># Azure Service Bus

> [MassTransit.Azure.ServiceBus.Core](https://nuget.org/packages/MassTransit.Azure.ServiceBus.Core/)

The Azure Service Bus transport only supports Standard and Premium tiers of the Microsoft Azure Service Bus service. Premium tier is recommended for production environments.

To configure Azure Service Bus, use the connection string (from the Azure portal) to configure the host as shown below.

<<< @/docs/code/transports/ServiceBusConsoleListener.cs

Additional host properties include:

| Property                |  Description 
|-------------------------|------------------
| TokenCredential       | Use a specific token-based credential, such as a managed identity token, to access the namespace.  You can use the [DefaultAzureCredential](https://docs.microsoft.com/en-us/dotnet/api/azure.identity.defaultazurecredential?view=azure-dotnet) to automatically apply any one of several credential types.
| TransportType         | Change the transport type from the default (AMQP) to use WebSockets

The following example shows how to configure Azure Service Bus using an Azure Managed Identity:

```csharp
namespace ServiceBusConsoleListener
{
    using System;
    using System.Threading.Tasks;
    using Azure.Identity;
    using MassTransit;
    using MassTransit.Azure.ServiceBus.Core.Configurators;
    using Microsoft.Extensions.DependencyInjection;

    public class Program
    {
        public static async Task Main()
        {
            var services = new ServiceCollection();
            services.AddMassTransit(x =>
            {
                x.UsingAzureServiceBus((context, cfg) =>
                {
                    var settings = new HostSettings
                    {
                        ServiceUri = new Uri("sb://your-service-bus-namespace.servicebus.windows.net"),
                        TokenCredential = new DefaultAzureCredential() // From Azure.Identity.dll
                    };
                    cfg.Host(settings);
                });
            });
        }
    }
}

```

During local development, in the case of Visual Studio, you can configure the account to use under Options -> Azure Service Authentication. Note that your Azure Active Directory user needs explicit access to the resource and have the 'Azure Service Bus Data Owner' role assigned.

Azure Service Bus queues includes an extensive set a properties that can be configured. All of these are optional, MassTransit uses sensible defaults, but the control is there when needed.
{'fraction_non_alphanumeric': 0.08125765618619844, 'fraction_numerical': 0.0, 'mean_word_length': 2.5942773294203962, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3607960', 'n_tokens_mistral': 1141, 'n_tokens_neox': 1090, 'n_words': 448}