Introduction
In this article, we are going to see how to create an Azure IoT Hub using Azure PowerShell cmdlets. IoT Hub is used to connect, manage, and monitor billions of IoT devices. It securely connects the devices to develop IoT applications. IoT Hub is a flexible cloud platform service that supports multiple protocols and open-source SDKs.
Prerequisite
Connecting to Azure Portal
Connect to Azure Portal using Connect-AzureRmAccount cmdlet.
Connect-AzureRmAccount
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 center location of the resource group, such as South India or East US.
- $ResourceGroupName="MyIOTRG"
- $location="East US"
- New-AzureRmResourceGroup -Name $ResourceGroupName -Location $location
Looking at our Azure portal, we can see the new resource group has been created.
Creating Azure IoT Hub
You can create Azure IoT Hub using New-AzureRmIotHub cmdlets. This 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 center location of the resource group, such as South India and east us.
- SkuName - Specify the SKU name for the storage account.
- $IoTHubName="jsiotconnect"
- New-AzureRmIotHub -ResourceGroupName $ResourceGroupName -Name $IoTHubName -SkuName S1 -Units 1 -Location $location
Final Code
- Connect-AzureRmAccount
- $ResourceGroupName="MyIOTRG"
- $location="East US"
- New-AzureRmResourceGroup -Name $ResourceGroupName -Location $location
- $IoTHubName="jsiotconnect "
- New-AzureRmIotHub -ResourceGroupName $ResourceGroupName -Name $IoTHubName -SkuName S1 -Units 1 -Location $location
I hope you have learned how to create an Azure IoT Hub using Azure PowerShell programmatically. Feel free to fill up the comment box below if you need any assistance.