New-AzIotHub

Creates a new IotHub.

Syntax

New-AzIotHub
   -ResourceGroupName <String>
   -Name <String>
   -SkuName <PSIotHubSku>
   -Units <Int64>
   -Location <String>
   [-Properties <PSIotHubInputProperties>]
   [-Tag <Hashtable>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

Creates a new IotHub. You can create the IotHub with either the default properties or specify the input properties.

Examples

Example 1 Create a new IotHub with default properties

PS C:\> $tags = @{}
PS C:\> $tags.Add('key1','value1')
PS C:\> New-AzIotHub -ResourceGroupName "myresourcegroup" -Name "myiothub" -SkuName "S1" -Units 1 -Location "northeurope" -Tag $tags

Creates a new IotHub named "myiothub" of the sku "S1", capacity 1 and location "northeurope" included with Tags.

Example 2 Create a new IotHub with the MaxDeliveryCount of the CloudToDevice Queue set to 20

PS C:\> New-AzIotHub -ResourceGroupName "myresourcegroup" -Name "myiothub" -SkuName "S1" -Units 1 -Location "northeurope" -Properties $properties

Creates a new IotHub named "myiothub" of the sku "S1", capacity 1 and location "northeurope" with advanced input properties represented by $properties. $psCloudToDeviceProperties = New-Object Microsoft.Azure.Commands.Management.IotHub.Models.PSCloudToDeviceProperties -Property @{MaxDeliveryCount=20} $properties = New-Object Microsoft.Azure.Commands.Management.IotHub.Models.PSIotHubInputProperties -Property @{CloudToDevice=$psCloudToDeviceProperties} New-AzIotHub -ResourceGroupName "myresourcegroup" -Name "myiothub" -SkuName "S1" -Units 1 -Location "northeurope" -Properties $properties

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
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
-Location

Location where the IoT hub needs to be created.

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

Name of the IotHub

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

Properties of the IoT hub.

Type:Microsoft.Azure.Commands.Management.IotHub.Models.PSIotHubInputProperties
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ResourceGroupName

Resource Group Name

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

Name of the sku

Type:Microsoft.Azure.Commands.Management.IotHub.Models.PSIotHubSku
Accepted values:F1, S1, S2, S3, B1, B2, B3
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Tag

IoT hub instance tags. Property bag in key-value pairs in the form of a hash table.

Type:Hashtable
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Units

Number of units

Type:Int64
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:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

Outputs

PSIotHub