Add-AzIotHubModule

Create a module on a target IoT device in an IoT Hub.

Syntax

Add-AzIotHubModule
   [-ResourceGroupName] <String>
   [-IotHubName] <String>
   [-DeviceId] <String>
   [-ModuleId] <String>
   [-AuthMethod <PSDeviceAuthType>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzIotHubModule
   [-InputObject] <PSIotHub>
   [-DeviceId] <String>
   [-ModuleId] <String>
   [-AuthMethod <PSDeviceAuthType>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzIotHubModule
   [-ResourceId] <String>
   [-DeviceId] <String>
   [-ModuleId] <String>
   [-AuthMethod <PSDeviceAuthType>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

Create a module on a target IoT device with different authorization type in an IoT Hub.

Examples

Example 1

PS C:\> Add-AzIoTHubModule -ResourceGroupName "myresourcegroup" -IotHubName "myiothub" -DeviceId "myDevice1" -ModuleId "myModule1" -AuthMethod shared_private_key

ModuleId                   : myModule1
DeviceId                   : myDevice1
GenerationId               : 637148941292917073
ETag                       : "NzIyMDI4MTk3"
LastActivityTime           : 1/1/0001 12:00:00 AM
ConnectionState            : Disconnected
ConnectionStateUpdatedTime : 1/1/0001 12:00:00 AM
CloudToDeviceMessageCount  : 0
Authentication             : Sas
ManagedBy                  :

Create a module on a target IoT device with default authorization (shared private key).

Parameters

-AuthMethod

The authorization type an entity is to be created with.

Type:Microsoft.Azure.Commands.Management.IotHub.Models.PSDeviceAuthType
Accepted values:shared_private_key, x509_thumbprint, x509_ca
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DeviceId

Target Device Id.

Type:String
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InputObject

IotHub object

Type:PSIotHub
Position:0
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-IotHubName

Name of the Iot Hub

Type:String
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ModuleId

Target Module Id.

Type:String
Position:2
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PrimaryThumbprint

Explicit self-signed certificate thumbprint to use for primary key.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ResourceGroupName

Name of the Resource Group

Type:String
Position:0
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ResourceId

IotHub Resource Id

Type:String
Position:0
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-SecondaryThumbprint

Explicit self-signed certificate thumbprint to use for secondary key.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

PSIotHub

String

Outputs

Microsoft.Azure.Commands.Management.IotHub.Models.PSModule

Notes