Search icon CANCEL
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Azure IoT Development Cookbook

You're reading from  Azure IoT Development Cookbook

Product type Book
Published in Aug 2017
Publisher Packt
ISBN-13 9781787283008
Pages 254 pages
Edition 1st Edition
Languages
Author (1):
Yatish Patil Yatish Patil
Profile icon Yatish Patil

Table of Contents (10) Chapters

Preface 1. Getting Started with the Azure IoT Platform 2. Introducing Device Management 3. IoT Hub Messaging and Commands 4. Azure IoT Communication Protocols 5. Azure IoT Hub Security and Best Practices 6. IoT Suite and Pre-Configured Solutions 7. Azure IoT Analytics 8. Using Real Devices to Connect and Implement Azure IoT Hub 9. Managing the Azure IoT Hub

Creating Azure IoT Hub from PowerShell

In this recipe, you will need to use the Azure account where you will create the IoT Hub. Apart from this Azure PowerShell should be installed on your machine.

To install PowerShell, follow this URL: https://docs.microsoft.com/en-gb/powershell/azure/install-azurerm-ps?view=azurermps-4.2.0.

How to do it...

Let's look at this section to create IoT Hub using PowerShell:

  1. Open PowerShell in administrator mode:
Start PowerShell in administrator mode
  1. Once the PowerShell window is ready, log in to the Azure account using the command:
'Login-AzureRmAccount'
Login to Azure account
  1. If you have only one Azure subscription, then you are good to go.
  2. If you have multiple subscriptions, first we need to select the subscription which we need to work on.
  3. To view a list of all the available Azure subscription for your work use the following command:
'Get-AzureRMSubscription'
  1. Select the subscription with the command, (in my case it is Visual Studio Enterprise):
Select-AzureRMSubscription -SubscriptionName "{subscription name}"
Select the Azure account to work with
  1. Before we create the IoT Hub, we need to create a resource group, which this IoT Hub will be a part of.
  2. The command to create a new resource group is the following:
New-AzureRmResourceGroup -Name MyBookIoTHub -Location "West US"
Add new resource group
  1. We will create the IoT Hub using the following command:
New-AzureRmIotHub `
-ResourceGroupName MyBookIoTHub `
-Name MyBookIoTHub `
-SkuName S1 -Units 1 `
-Location "West US"
Azure IoT Hub created
  1. You can log in to the Azure portal and view the newly created IoT Hub:
IoT Hub list view
  1. To view the available IoT Hub in your account, use the command:
Get-AzureRmIotHub
  1. To delete an existing IoT Hub, use the following command:
Remove-AzureRmIotHub `
-ResourceGroupName MyBookIoTHub `
-Name MyBookIoTHub
You have been reading a chapter from
Azure IoT Development Cookbook
Published in: Aug 2017 Publisher: Packt ISBN-13: 9781787283008
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}