Skip to content

Commit 0a5b057

Browse files
authored
Merge pull request #212127 from w-azure/winona-hub-template
Reconstructing article for template in PowerShell
2 parents cb922b9 + 39b7443 commit 0a5b057

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

articles/iot-hub/iot-hub-rm-template-powershell.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,25 @@ ms.custom: devx-track-azurepowershell
1515

1616
[!INCLUDE [iot-hub-resource-manager-selector](../../includes/iot-hub-resource-manager-selector.md)]
1717

18-
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).
1919

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)
2123

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.
2325

24-
[!code-json[iothub-creation](~/quickstart-templates/quickstarts/microsoft.devices/iothub-with-consumergroup-create/azuredeploy.json)]
26+
## Create an IoT hub
2527

26-
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).
2729

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.
2933

3034
```azurepowershell-interactive
3135
$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)"
3337
$iotHubName = Read-Host -Prompt "Enter the IoT Hub name"
3438
3539
New-AzResourceGroup -Name $resourceGroupName -Location "$location"
@@ -42,6 +46,7 @@ New-AzResourceGroupDeployment `
4246
> [!NOTE]
4347
> 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).
4448
49+
4550
## Next steps
4651

4752
Since you've deployed an IoT hub, using an Azure Resource Manager template, you may want to explore:

includes/iot-hub-prepare-resource-manager.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Install the [Azure PowerShell cmdlets][lnk-powershell-install] before you contin
1212

1313
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).
1414

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.
1616

1717
```powershell
1818
Connect-AzAccount
@@ -26,10 +26,10 @@ The following steps show how to set up authentication for your app to register w
2626
Get-AzSubscription
2727
```
2828

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.
3030

3131
```powershell
32-
Select-AzSubscription -SubscriptionName "{your-subscription-name}"
32+
Select-AzSubscription -SubscriptionName "{your subscription Name or Id}"
3333
```
3434

3535
1. Save your `Id` and `TenantId` for later.

0 commit comments

Comments
 (0)