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
stringThe 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
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
ManagementPort
Gets or sets the TCP port number for management operations.
public int ManagementPort { get; set; }
Property Value
- int
The management port.
Remarks
This is only used in server scenario. When generating connection string for Azure service, this should be left at its default value.
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
Get or sets the publisher identifier.
public string Publisher { get; set; }
Property Value
RuntimePort
Gets or sets the TCP port number for runtime operation.
public int RuntimePort { get; set; }
Property Value
- int
The runtime port.
Remarks
This is only used in server scenario. When generating connection string for Azure service, this should be left at its default value.
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
Gets or sets the SAS access token.
public string SharedAccessSignature { get; set; }
Property Value
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.
Remarks
If not set, default is Amqp for EventHubClient, otherwise default is NetMessaging
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
intThe runtime port.
managementPort
intThe management port.
domain
stringThe domain where the connection will be established.
user
stringThe authentication user.
password
SecureStringThe 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
intThe runtime port.
managementPort
intThe management port.
keyName
stringThe name of the shared access key.
key
stringThe 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
UriThe endpoint.
keyName
stringThe name of the shared access key.
key
stringThe shared access key.
Returns
- string
The created connection using the shared access key.
CreateUsingSharedAccessSignature(Uri, string, string, string)
Creates a connection string using SAS credentials.
public static string CreateUsingSharedAccessSignature(Uri endpoint, string entityPath, string publisher, string sharedAccessSignature)
Parameters
endpoint
UriThe endpoint.
entityPath
stringThe path to the messaging entity.
publisher
stringThe publisher ID.
sharedAccessSignature
stringThe SAS key.
Returns
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
intThe runtime port.
managementPort
intThe management port.
issuer
stringThe issuer.
issuerSecret
stringThe 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
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
intThe runtime port.
managementPort
intThe management port.
domain
stringThe domain where the connection will be established.
user
stringThe user.
password
SecureStringThe 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.