ProvisioningDeviceClient.RegisterAsync Method

Definition

Overloads

RegisterAsync(CancellationToken)

Registers the current device using the Device Provisioning Service and assigns it to an IoT hub.

RegisterAsync(TimeSpan)

Registers the current device using the Device Provisioning Service and assigns it to an IoT hub.

RegisterAsync(ProvisioningRegistrationAdditionalData, CancellationToken)

Registers the current device using the Device Provisioning Service and assigns it to an IoT hub.

RegisterAsync(ProvisioningRegistrationAdditionalData, TimeSpan)

Registers the current device using the Device Provisioning Service and assigns it to an IoT hub.

RegisterAsync(RegistrationRequestPayload, CancellationToken)

Registers the current device using the Device Provisioning Service and assigns it to an IoT hub.

RegisterAsync(CancellationToken)

Registers the current device using the Device Provisioning Service and assigns it to an IoT hub.

public System.Threading.Tasks.Task<Microsoft.Azure.Devices.Provisioning.Client.DeviceRegistrationResult> RegisterAsync (System.Threading.CancellationToken cancellationToken = default);
member this.RegisterAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Devices.Provisioning.Client.DeviceRegistrationResult>
Public Function RegisterAsync (Optional cancellationToken As CancellationToken = Nothing) As Task(Of DeviceRegistrationResult)

Parameters

cancellationToken
CancellationToken

The cancellation token.

Returns

The registration result.

Remarks

Due to the AMQP library used by this library uses not accepting cancellation tokens, the provided cancellation token will only be checked for cancellation in between AMQP operations, and not during. In order to have a timeout for this operation that is checked during AMQP operations (such as opening the connection), you must use RegisterAsync(TimeSpan) instead. MQTT and HTTPS connections do not have the same behavior as AMQP connections in this regard. MQTT and HTTPS connections will check this cancellation token for cancellation during their protocol level operations.

Applies to

RegisterAsync(TimeSpan)

Registers the current device using the Device Provisioning Service and assigns it to an IoT hub.

public System.Threading.Tasks.Task<Microsoft.Azure.Devices.Provisioning.Client.DeviceRegistrationResult> RegisterAsync (TimeSpan timeout);
member this.RegisterAsync : TimeSpan -> System.Threading.Tasks.Task<Microsoft.Azure.Devices.Provisioning.Client.DeviceRegistrationResult>
Public Function RegisterAsync (timeout As TimeSpan) As Task(Of DeviceRegistrationResult)

Parameters

timeout
TimeSpan

The maximum amount of time to allow this operation to run for before timing out.

Returns

The registration result.

Remarks

Due to the AMQP library used by this library uses not accepting cancellation tokens, this overload and RegisterAsync(ProvisioningRegistrationAdditionalData, TimeSpan) are the only overloads for this method that allow for a specified timeout to be respected in the middle of an AMQP operation such as opening the AMQP connection. MQTT and HTTPS connections do not share that same limitation, though.

Applies to

RegisterAsync(ProvisioningRegistrationAdditionalData, CancellationToken)

Registers the current device using the Device Provisioning Service and assigns it to an IoT hub.

public System.Threading.Tasks.Task<Microsoft.Azure.Devices.Provisioning.Client.DeviceRegistrationResult> RegisterAsync (Microsoft.Azure.Devices.Provisioning.Client.ProvisioningRegistrationAdditionalData data, System.Threading.CancellationToken cancellationToken = default);
member this.RegisterAsync : Microsoft.Azure.Devices.Provisioning.Client.ProvisioningRegistrationAdditionalData * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Devices.Provisioning.Client.DeviceRegistrationResult>
Public Function RegisterAsync (data As ProvisioningRegistrationAdditionalData, Optional cancellationToken As CancellationToken = Nothing) As Task(Of DeviceRegistrationResult)

Parameters

data
ProvisioningRegistrationAdditionalData

The optional additional data that is passed through to the custom allocation policy webhook if a custom allocation policy webhook is setup for this enrollment.

cancellationToken
CancellationToken

The cancellation token.

Returns

The registration result.

Remarks

Due to the AMQP library used by this library uses not accepting cancellation tokens, the provided cancellation token will only be checked for cancellation in between AMQP operations, and not during. In order to have a timeout for this operation that is checked during AMQP operations (such as opening the connection), you must use this overload instead. MQTT and HTTPS connections do not have the same behavior as AMQP connections in this regard. MQTT and HTTPS connections will check this cancellation token for cancellation during their protocol level operations.

Applies to

RegisterAsync(ProvisioningRegistrationAdditionalData, TimeSpan)

Registers the current device using the Device Provisioning Service and assigns it to an IoT hub.

public System.Threading.Tasks.Task<Microsoft.Azure.Devices.Provisioning.Client.DeviceRegistrationResult> RegisterAsync (Microsoft.Azure.Devices.Provisioning.Client.ProvisioningRegistrationAdditionalData data, TimeSpan timeout);
member this.RegisterAsync : Microsoft.Azure.Devices.Provisioning.Client.ProvisioningRegistrationAdditionalData * TimeSpan -> System.Threading.Tasks.Task<Microsoft.Azure.Devices.Provisioning.Client.DeviceRegistrationResult>
Public Function RegisterAsync (data As ProvisioningRegistrationAdditionalData, timeout As TimeSpan) As Task(Of DeviceRegistrationResult)

Parameters

data
ProvisioningRegistrationAdditionalData

The optional additional data that is passed through to the custom allocation policy webhook if a custom allocation policy webhook is setup for this enrollment.

timeout
TimeSpan

The maximum amount of time to allow this operation to run for before timing out.

Returns

The registration result.

Remarks

Due to the AMQP library used by this library uses not accepting cancellation tokens, this overload and RegisterAsync(TimeSpan) are the only overloads for this method that allow for a specified timeout to be respected in the middle of an AMQP operation such as opening the AMQP connection. MQTT and HTTPS connections do not share that same limitation, though.

Applies to

RegisterAsync(RegistrationRequestPayload, CancellationToken)

Registers the current device using the Device Provisioning Service and assigns it to an IoT hub.

public System.Threading.Tasks.Task<Microsoft.Azure.Devices.Provisioning.Client.DeviceRegistrationResult> RegisterAsync (Microsoft.Azure.Devices.Provisioning.Client.RegistrationRequestPayload data, System.Threading.CancellationToken cancellationToken = default);
member this.RegisterAsync : Microsoft.Azure.Devices.Provisioning.Client.RegistrationRequestPayload * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Devices.Provisioning.Client.DeviceRegistrationResult>
Public Function RegisterAsync (data As RegistrationRequestPayload, Optional cancellationToken As CancellationToken = Nothing) As Task(Of DeviceRegistrationResult)

Parameters

data
RegistrationRequestPayload

The optional additional data that is passed through to the custom allocation policy webhook if a custom allocation policy webhook is setup for this enrollment.

cancellationToken
CancellationToken

The cancellation token.

Returns

The registration result.

Applies to