Modules - Create Or Update Identity
Creates or updates the module identity for a device in the IoT Hub. The moduleId and generationId cannot be updated by the user.
PUT https://fully-qualified-iothubname.azure-devices.net/devices/{id}/modules/{mid}?api-version=2021-04-12
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
id
|
path | True |
string |
The unique identifier of the device. |
mid
|
path | True |
string |
The unique identifier of the module. |
api-version
|
query | True |
string |
Version of the Api. |
Request Header
Name | Required | Type | Description |
---|---|---|---|
If-Match |
string |
The string representing a weak ETag for the module, as per RFC7232. This should not be set when creating a module, but may be set when updating a module. |
Request Body
Name | Type | Description |
---|---|---|
authentication |
The authentication mechanism used by the module when connecting to the service and edge hub. |
|
cloudToDeviceMessageCount |
integer |
The number of cloud-to-module messages currently queued to be sent to the module. |
connectionState |
enum:
|
The connection state of the device. |
connectionStateUpdatedTime |
string |
The date and time the connection state was last updated. |
deviceId |
string |
The unique identifier of the device. |
etag |
string |
The string representing a weak ETag for the module identity, as per RFC7232. |
generationId |
string |
The IoT Hub generated, case-sensitive string up to 128 characters long. This value is used to distinguish modules with the same moduleId, when they have been deleted and re-created. |
lastActivityTime |
string |
The date and time the device last connected, received, or sent a message. |
managedBy |
string |
Identifies who manages this module. For instance, this value is "IotEdge" if the edge runtime owns this module. |
moduleId |
string |
The unique identifier of the module. |
Responses
Name | Type | Description |
---|---|---|
200 OK |
OK. |
|
201 Created |
Created. |
Definitions
Name | Description |
---|---|
Authentication |
|
Module |
The module identity on a device. |
Symmetric |
|
X509Thumbprint |
AuthenticationMechanism
Name | Type | Description |
---|---|---|
symmetricKey |
The primary and secondary keys used for SAS based authentication. |
|
type |
enum:
|
The type of authentication used to connect to the service. |
x509Thumbprint |
The primary and secondary x509 thumbprints used for x509 based authentication. |
Module
The module identity on a device.
Name | Type | Description |
---|---|---|
authentication |
The authentication mechanism used by the module when connecting to the service and edge hub. |
|
cloudToDeviceMessageCount |
integer |
The number of cloud-to-module messages currently queued to be sent to the module. |
connectionState |
enum:
|
The connection state of the device. |
connectionStateUpdatedTime |
string |
The date and time the connection state was last updated. |
deviceId |
string |
The unique identifier of the device. |
etag |
string |
The string representing a weak ETag for the module identity, as per RFC7232. |
generationId |
string |
The IoT Hub generated, case-sensitive string up to 128 characters long. This value is used to distinguish modules with the same moduleId, when they have been deleted and re-created. |
lastActivityTime |
string |
The date and time the device last connected, received, or sent a message. |
managedBy |
string |
Identifies who manages this module. For instance, this value is "IotEdge" if the edge runtime owns this module. |
moduleId |
string |
The unique identifier of the module. |
SymmetricKey
Name | Type | Description |
---|---|---|
primaryKey |
string |
The base64 encoded primary key of the device. |
secondaryKey |
string |
The base64 encoded secondary key of the device. |
X509Thumbprint
Name | Type | Description |
---|---|---|
primaryThumbprint |
string |
The X509 client certificate primary thumbprint. |
secondaryThumbprint |
string |
The X509 client certificate secondary thumbprint. |