Service - Create Or Update Module

Create or update the module identity for device in IoT hub. An ETag must not be specified for the create operation. An ETag must be specified for the update operation. Note that moduleId and generation cannot be updated by the user.

PUT https://fully-qualified-iothubname.azure-devices.net/devices/{id}/modules/{mid}?api-version=2018-06-30

URI Parameters

Name In Required Type Description
id
path True
  • string

Device ID.

mid
path True
  • string

Module ID.

api-version
query True
  • string

Version of the Api.

Request Header

Name Required Type Description
If-Match
  • string

Request Body

Name Type Description
authentication
cloudToDeviceMessageCount
  • integer
connectionState enum:
  • Disconnected
  • Connected
connectionStateUpdatedTime
  • string
deviceId
  • string
etag
  • string
generationId
  • string
lastActivityTime
  • string
managedBy
  • string
moduleId
  • string

Responses

Name Type Description
200 OK

Returns the updated DeviceModule object

201 Created

Returns the created DeviceModule object

Definitions

AuthenticationMechanism
Module

Module identity on a device

SymmetricKey
X509Thumbprint

AuthenticationMechanism

Name Type Description
symmetricKey
type enum:
  • certificateAuthority
  • none
  • sas
  • selfSigned
x509Thumbprint

Module

Module identity on a device

Name Type Description
authentication
cloudToDeviceMessageCount
  • integer
connectionState enum:
  • Connected
  • Disconnected
connectionStateUpdatedTime
  • string
deviceId
  • string
etag
  • string
generationId
  • string
lastActivityTime
  • string
managedBy
  • string
moduleId
  • string

SymmetricKey

Name Type Description
primaryKey
  • string
secondaryKey
  • string

X509Thumbprint

Name Type Description
primaryThumbprint
  • string
secondaryThumbprint
  • string