Table of Contents

Class ServiceBusConnectionStringBuilder

Namespace
Microsoft.ServiceBus
Assembly
Microsoft.ServiceBus.dll

Creates and manages the contents of connection strings. You can use this class to construct a connection string for creating client messaging entities. It can also be used to perform basic validation on an existing connection string.

public class ServiceBusConnectionStringBuilder
Inheritance
ServiceBusConnectionStringBuilder
Inherited Members

Constructors

ServiceBusConnectionStringBuilder()

Initializes a new instance of the ServiceBusConnectionStringBuilder class.

public ServiceBusConnectionStringBuilder()

ServiceBusConnectionStringBuilder(string)

Initializes a new instance of the ServiceBusConnectionStringBuilder class with a specified existing connection string.

public ServiceBusConnectionStringBuilder(string connectionString)

Parameters

connectionString string

The connection string, which you can obtain from the Azure Management Portal.

Exceptions

System.Configuration.ConfigurationErrorsException

Throws if The connection string is missing endpoints.The connection string does not have enough information to form a token provider. For example, this can happen if you supplied a SasIssuer name but not a SasIssuer key.The OperationTimeout value is not in a valid TimeSpan format.The RuntimePort or ManagementPort values are not in an integer format.

Properties

EnableAmqpLinkRedirect

public bool EnableAmqpLinkRedirect { get; set; }

Property Value

bool

Endpoints

Gets a collection of service endpoints. Each endpoint must reference the same Service Bus namespace.

public HashSet<Uri> Endpoints { get; }

Property Value

HashSet<Uri>

A set of endpoints.

EntityPath

public string EntityPath { get; set; }

Property Value

string

ManagementPort

Gets or sets the TCP port number for management operations.

public int ManagementPort { get; set; }

Property Value

int

The management port.

OAuthDomain

Gets or sets the authentication domain for the connection.

public string OAuthDomain { get; set; }

Property Value

string

The authentication domain for the connection.

OAuthPassword

Gets or sets the authentication password for the connection.

public SecureString OAuthPassword { get; set; }

Property Value

SecureString

The authentication password for the connection.

OAuthUsername

Gets or sets the authentication user name for the connection.

public string OAuthUsername { get; set; }

Property Value

string

The authentication user name for the connection.

OperationTimeout

Gets or sets the TimeSpan that specifies how long the messaging operation has to complete before timing out.

public TimeSpan OperationTimeout { get; set; }

Property Value

TimeSpan

The TimeSpan that specifies how long the messaging operation has to complete before timing out. The default value is one minute.

Publisher

public string Publisher { get; set; }

Property Value

string

RuntimePort

Gets or sets the TCP port number for runtime operation.

public int RuntimePort { get; set; }

Property Value

int

The runtime port.

SharedAccessKey

Gets or sets the shared access key for the connection authentication.

public string SharedAccessKey { get; set; }

Property Value

string

The shared access key for the connection authentication.

SharedAccessKeyName

Gets or sets the name of the shared access key.

public string SharedAccessKeyName { get; set; }

Property Value

string

The name of the shared access key.

SharedAccessSignature

public string SharedAccessSignature { get; set; }

Property Value

string

SharedSecretIssuerName

Gets or sets the shared secret issuer name.

public string SharedSecretIssuerName { get; set; }

Property Value

string

The shared secret issuer name.

SharedSecretIssuerSecret

Gets or sets the shared secret issuer secret.

public string SharedSecretIssuerSecret { get; set; }

Property Value

string

The shared secret issuer secret.

StsEndpoints

Gets a set of STS endpoints.

public HashSet<Uri> StsEndpoints { get; }

Property Value

HashSet<Uri>

A set of STS endpoints.

TransportType

Gets or sets the transport type to be used for client messaging entities.

public TransportType TransportType { get; set; }

Property Value

TransportType

The transport type associated with the connection.

WindowsCredentialDomain

Gets or sets the Windows credential domain.

public string WindowsCredentialDomain { get; set; }

Property Value

string

The Windows credential domain.

WindowsCredentialPassword

Gets or sets the Windows credential password.

public SecureString WindowsCredentialPassword { get; set; }

Property Value

SecureString

The Windows credential password.

WindowsCredentialUsername

Gets or sets the Windows credential user name.

public string WindowsCredentialUsername { get; set; }

Property Value

string

The Windows credential user name.

Methods

CreateUsingOAuthCredential(IEnumerable<Uri>, IEnumerable<Uri>, int, int, string, string, SecureString)

Creates a connection string using authentication credentials.

public static string CreateUsingOAuthCredential(IEnumerable<Uri> endpoints, IEnumerable<Uri> stsEndpoints, int runtimePort, int managementPort, string domain, string user, SecureString password)

Parameters

endpoints IEnumerable<Uri>

The set of endpoints.

stsEndpoints IEnumerable<Uri>

The set of security token service endpoints.

runtimePort int

The runtime port.

managementPort int

The management port.

domain string

The domain where the connection will be established.

user string

The authentication user.

password SecureString

The authentication password.

Returns

string

The created service bus connection string.

CreateUsingSharedAccessKey(IEnumerable<Uri>, int, int, string, string)

Create a connection string using the shared access key.

public static string CreateUsingSharedAccessKey(IEnumerable<Uri> endpoints, int runtimePort, int managementPort, string keyName, string key)

Parameters

endpoints IEnumerable<Uri>

The set of endpoints.

runtimePort int

The runtime port.

managementPort int

The management port.

keyName string

The name of the shared access key.

key string

The shared access key

Returns

string

The created connection using the shared access key.

CreateUsingSharedAccessKey(Uri, string, string)

Create a connection string using the shared access key.

public static string CreateUsingSharedAccessKey(Uri endpoint, string keyName, string key)

Parameters

endpoint Uri

The endpoint.

keyName string

The name of the shared access key.

key string

The shared access key.

Returns

string

The created connection using the shared access key.

CreateUsingSharedAccessSignature(Uri, string, string, string)

public static string CreateUsingSharedAccessSignature(Uri endpoint, string entityPath, string publisher, string sharedAccessSignature)

Parameters

endpoint Uri
entityPath string
publisher string
sharedAccessSignature string

Returns

string

CreateUsingSharedSecret(IEnumerable<Uri>, IEnumerable<Uri>, int, int, string, string)

Creates a connection string using the shared secret credentials.

public static string CreateUsingSharedSecret(IEnumerable<Uri> endpoints, IEnumerable<Uri> stsEndpoints, int runtimePort, int managementPort, string issuer, string issuerSecret)

Parameters

endpoints IEnumerable<Uri>

The endpoints.

stsEndpoints IEnumerable<Uri>

The set of security token service endpoints.

runtimePort int

The runtime port.

managementPort int

The management port.

issuer string

The issuer.

issuerSecret string

The issuer secret.

Returns

string

The created connection using the shared secret credentials.

CreateUsingSharedSecret(Uri, string, string)

Creates a connection string using the shared secret credentials.

public static string CreateUsingSharedSecret(Uri endpoint, string issuer, string issuerSecret)

Parameters

endpoint Uri

The endpoint.

issuer string

The issuer

issuerSecret string

The issuer secret.

Returns

string

The created connection using the shared secret credentials.

CreateUsingWindowsCredential(IEnumerable<Uri>, IEnumerable<Uri>, int, int, string, string, SecureString)

Creates a connection string using Windows credentials.

public static string CreateUsingWindowsCredential(IEnumerable<Uri> endpoints, IEnumerable<Uri> stsEndpoints, int runtimePort, int managementPort, string domain, string user, SecureString password)

Parameters

endpoints IEnumerable<Uri>

The set of endpoints

stsEndpoints IEnumerable<Uri>

The set of security token service endpoints.

runtimePort int

The runtime port.

managementPort int

The management port.

domain string

The domain where the connection will be established.

user string

The user.

password SecureString

The windows password.

Returns

string

The created connection string.

GetAbsoluteManagementEndpoints()

Retrieves the absolute management endpoints.

public IList<Uri> GetAbsoluteManagementEndpoints()

Returns

IList<Uri>

The absolute management endpoints

GetAbsoluteRuntimeEndpoints()

Retrieves the absolute runtime endpoints.

public IList<Uri> GetAbsoluteRuntimeEndpoints()

Returns

IList<Uri>

The absolute runtime endpoints.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.