ConnectionString class

Describes the parameters that enable a device or cloud application to connect to an Azure IoT hub.

Properties

DeviceId

Unique device identifier as it exists in the device identity registry. This is only used for device connection strings.

GatewayHostName

IP address or internet name of the host machine working as a device or protocol gateway. Used when communicating with Azure Edge devices.

HostName

Hostname of the Azure IoT hub.

ModuleId

Unique module identifier as it exists in the device identity registry. This is only used for device connection strings.

SharedAccessKey

Symmetric key used to create shared access signature tokens that are in turn used to authenticate the connection. Associated either with a specific device or a specific service policy.

SharedAccessKeyName

Name of the access policy used to connect to the Azure IoT hub. used only in the case of the service SDK, unused with the Device SDK (which uses DeviceId instead).

SharedAccessSignature

A shared access signature which encapsulates "device connect" permissions on an IoT hub.

x509

This property exists only if a device uses x509 certificates for authentication and if it exists, will be set to True.

Methods

parse(string, string[])

Parses a string and returns the corresponding ConnectionString object.

Property Details

DeviceId

Unique device identifier as it exists in the device identity registry. This is only used for device connection strings.

DeviceId?: string

Property Value

string

GatewayHostName

IP address or internet name of the host machine working as a device or protocol gateway. Used when communicating with Azure Edge devices.

GatewayHostName?: string

Property Value

string

HostName

Hostname of the Azure IoT hub.

HostName?: string

Property Value

string

ModuleId

Unique module identifier as it exists in the device identity registry. This is only used for device connection strings.

ModuleId?: string

Property Value

string

SharedAccessKey

Symmetric key used to create shared access signature tokens that are in turn used to authenticate the connection. Associated either with a specific device or a specific service policy.

SharedAccessKey?: string

Property Value

string

SharedAccessKeyName

Name of the access policy used to connect to the Azure IoT hub. used only in the case of the service SDK, unused with the Device SDK (which uses DeviceId instead).

SharedAccessKeyName?: string

Property Value

string

SharedAccessSignature

A shared access signature which encapsulates "device connect" permissions on an IoT hub.

SharedAccessSignature?: string

Property Value

string

x509

This property exists only if a device uses x509 certificates for authentication and if it exists, will be set to True.

x509?: string

Property Value

string

Method Details

parse(string, string[])

Parses a string and returns the corresponding ConnectionString object.

static function parse(source: string, requiredFields?: string[]): ConnectionString

Parameters

source

string

string from which the connection string will be extracted

requiredFields

string[]

array of strings listing the fields that are expected to be found.

Returns