How to Create Azure IoT Hub Using Azure PowerShell

In this article we will create an Azure IoT Hub using Azure PowerShell cmdlets. IoT Hub is used to connect, manage and monitor a large number of IoT devices. It connects securely devices to develop IoT applications. IoT Hub is a flexible cloud platform service which supports multiple protocols and open-source SDKs.  


Before you begin to utilize PowerShell to oversee the Azure PowerShell, ensure that the Azure PowerShell has been installed. If not installed, here is an article to read on How to install Azure PowerShell module. Please also Install the Azure IoT module .You need to do this only once for each computer from which you which you will run Azure PowerShell commands. 

Connecting to Azure Portal: 

Connect to Azure Portal using Connect-AzureRmAccount cmdlet.  


Connecting to Azure Portal

Creating Azure Resource Group:  

You can create Resource Groups in Azure using New-AzureRmResourceGroup cmdlets. The required parameters are, 

Name – Specify the name of the resource group. 
Location – Specify the Azure data centre location of the resource group, such as south india and east us. 

SharePoint Intranet Software


$location=”East US” 

New-AzureRmResourceGroup -Name $ResourceGroupName -Location $location 

Looking at your azure portal we can see the new resource group has been created.

Azure New Resource Group

Creating Azure IoT Hub: 

You can create Azure IoT Hub using New-AzureRmIotHub cmdlets. The following example creates an S1 hub called jsiotconnect in the East US region. The required parameters are,  

ResourceGroupName – Specify the name of the resource group. 
Name  Specify the name of the IoT Hub 
Location – Specify the Azure data centre location of the resource group, such as south india and east US. 
SkuName  Specify the SKU name for the storage account.  


New-AzureRmIotHub -ResourceGroupName $ResourceGroupName -Name $IoTHubName -SkuName S1 -Units 1 -Location $location 

Creating Azure IoT Hub

Final Code: 



$location=”East US” 

New-AzureRmResourceGroup -Name $ResourceGroupName -Location $location 

$IoTHubName=”jsiotconnect “ 

New-AzureRmIotHub -ResourceGroupName $ResourceGroupName -Name $IoTHubName -SkuName S1 -Units 1 -Location $location 

Hope this has helped you to create Azure IoT Hub using Azure PowerShell programmatically. Feel free to fill up the comment box below if you need any assistance.  

Sharing is Caring!

Leave a Reply

Your email address will not be published. Required fields are marked *