You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Learn how to use an Azure Resource Manager template to create an IoT Hub and a consumer group. Resource Manager templates are JSON files that define the resources you need to deploy for your solution. For more information about developing Resource Manager templates, see [Azure Resource Manager documentation](../azure-resource-manager/index.yml).
18
+
This article shows you how to use an Azure Resource Manager template to create an IoT Hub and a [consumer group](https://learn.microsoft.com/azure/event-hubs/event-hubs-features#consumer-groups), using Azure PowerShell. Resource Manager templates are JSON files that define the resources you need to deploy for your solution. For more information about developing Resource Manager templates, see the[Azure Resource Manager documentation](../azure-resource-manager/index.yml).
19
19
20
-
## Create an IoT hub
20
+
## Prerequisites
21
+
22
+
[Azure PowerShell module](/powershell/azure/install-az-ps) or [Azure Cloud Shell](https://learn.microsoft.com/azure/cloud-shell/overview)
21
23
22
-
The following [Resource Manager JSON template](https://azure.microsoft.com/resources/templates/iothub-with-consumergroup-create/) used in this article is one of many templates from [Azure Quickstart Templates](https://azure.microsoft.com/resources/templates/). This template creates an Azure Iot hub with three endpoints (eventhub, cloud-to-device, and messaging) and a consumer group. For more information on the Iot Hub template schema, see [Microsoft.Devices (IoT Hub) resource types](/azure/templates/microsoft.devices/iothub-allversions).
24
+
Azure Cloud Shell is useful if you don't want to install the PowerShell module locally, as Cloud Shell performs from a browser.
There are several methods for deploying a template. You use Azure PowerShell in this article.
28
+
The [Resource Manager JSON template](https://azure.microsoft.com/resources/templates/iothub-with-consumergroup-create/) used in this article is one of many templates from [Azure Quickstart Templates](https://azure.microsoft.com/resources/templates/). The JSON template creates an Azure Iot hub with three endpoints (eventhub, cloud-to-device, and messaging) and a consumer group. For more information on the Iot Hub template schema, see [Microsoft.Devices (IoT Hub) resource types](https://learn.microsoft.com/azure/templates/microsoft.devices/iothub-allversions).
27
29
28
-
To run the following PowerShell script, select **Try it** to open the Azure Cloud Shell. Copy the script, paste it into the shell, and answer the prompts to create a new resource, choose a region, and create a new IoT hub.
30
+
Use the following PowerShell command to create a resource group which is then used to create an IoT hub. The JSON template is used in `-TemplateUri`.
31
+
32
+
To run the following PowerShell script, select **Try it** to open the Azure Cloud Shell. Copy the script, paste into your shell, then press enter. Answer the prompts. These prompts will help you to create a new resource, choose a region, and create a new IoT hub. Once answered, a confirmation of your IoT hub prints to the console.
29
33
30
34
```azurepowershell-interactive
31
35
$resourceGroupName = Read-Host -Prompt "Enter the Resource Group name"
32
-
$location = Read-Host -Prompt "Enter the location (i.e. centralus)"
36
+
$location = Read-Host -Prompt "Enter the location (for example: centralus)"
33
37
$iotHubName = Read-Host -Prompt "Enter the IoT Hub name"
> To use your own template, upload your template file to the Cloud Shell, and then use the `-TemplateFile` switch to specify the file name. For example, see [Deploy the template](../azure-resource-manager/templates/quickstart-create-templates-use-visual-studio-code.md?tabs=PowerShell#deploy-the-template).
44
48
49
+
45
50
## Next steps
46
51
47
52
Since you've deployed an IoT hub, using an Azure Resource Manager template, you may want to explore:
Copy file name to clipboardExpand all lines: includes/iot-hub-prepare-resource-manager.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ Install the [Azure PowerShell cmdlets][lnk-powershell-install] before you contin
12
12
13
13
The following steps show how to set up authentication for your app to register with Azure Active Directory. You can run these commands in a standard PowerShell session. Registering with Azure Active Directory is necessary to authenticate any future REST calls. For more information, see [How and why applications are added to Azure AD](/azure/active-directory/develop/active-directory-how-applications-are-added).
14
14
15
-
1. Sign in to your Azure subscription using the following command:
15
+
1. Sign in to your Azure subscription using the following command. If you're using PowerShell in Azure Cloud Shell you're already signed in, so you can skip this step.
16
16
17
17
```powershell
18
18
Connect-AzAccount
@@ -26,10 +26,10 @@ The following steps show how to set up authentication for your app to register w
26
26
Get-AzSubscription
27
27
```
28
28
29
-
Select the subscription you want to use. You can use either the subscription name or `Id` from the output of the previous command.
29
+
Select the subscription you want to use. You can use either the `Name` or `Id` from the output of the previous command.
0 commit comments