Skip to content

Commit a0d932f

Browse files
committed
Consolidate IoT Hub Create docs
1 parent bd88751 commit a0d932f

7 files changed

+151
-97
lines changed

articles/iot-hub/.openpublishing.redirection.iot-hub.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,6 +1420,16 @@
14201420
"redirect_url": "/azure/iot-hub/reference-iot-hub-extension",
14211421
"redirect_document_id": false
14221422
},
1423+
{
1424+
"source_path_from_root": "/articles/iot-hub/iot-hub-create-through-portal.md",
1425+
"redirect_url": "/azure/iot-hub/create-hub",
1426+
"redirect_document_id": true
1427+
},
1428+
{
1429+
"source_path_from_root": "/articles/iot-hub/iot-hub-create-using-cli.md",
1430+
"redirect_url": "/azure/iot-hub/create-hub",
1431+
"redirect_document_id": false
1432+
},
14231433
{
14241434
"source_path_from_root": "/articles/iot-hub/iot-hub-rm-template.md",
14251435
"redirect_url": "/azure/iot-hub/iot-hub-rm-template-powershell",

articles/iot-hub/create-hub.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
---
2+
title: Create an IoT hub
3+
titleSuffix: Azure IoT Hub
4+
description: How to create, manage, and delete Azure IoT hubs through the Azure portal and CLI. Includes information about pricing tiers, scaling, security, and messaging configuration.
5+
author: kgremban
6+
7+
ms.author: kgremban
8+
ms.service: iot-hub
9+
ms.topic: how-to
10+
ms.date: 06/10/2024
11+
ms.custom: ['Role: Cloud Development']
12+
---
13+
14+
# Create an IoT hub using the Azure portal
15+
16+
This article describes how to create and manage an IoT hub.
17+
18+
## Prerequisites
19+
20+
* Depending on which tool you use, either have access to the [Azure portal](https://portal.azure.com) or [install the Azure CLI](/cli/azure/install-azure-cli).
21+
22+
## Create an IoT hub
23+
24+
### [Azure portal](#tab/portal)
25+
26+
[!INCLUDE [iot-hub-include-create-hub](../../includes/iot-hub-include-create-hub.md)]
27+
28+
### [Azure CLI](#tab/cli)
29+
30+
Use the Azure CLI to create a resource group and then add an IoT hub.
31+
32+
Use the [iz iot hub create](/cli/azure/iot/hub#az-iot-hub-create) command to create an IoT hub in your resource group, using a globally unique name for your IoT hub. For example:
33+
34+
```azurecli-interactive
35+
az iot hub create --name <NEW_NAME_FOR_YOUR_IOT_HUB> \
36+
--resource-group <RESOURCE_GROUP_NAME> --sku S1
37+
```
38+
39+
[!INCLUDE [iot-hub-pii-note-naming-hub](../../includes/iot-hub-pii-note-naming-hub.md)]
40+
41+
The previous command creates an IoT hub in the S1 pricing tier for which you're billed. For more information, see [Azure IoT Hub pricing](https://azure.microsoft.com/pricing/details/iot-hub/).
42+
43+
---
44+
45+
## Update an IoT hub
46+
47+
You can change the settings of an existing IoT hub after it's created. Here are some properties you can set for an IoT hub:
48+
49+
* **Pricing and scale**: Migrate to a different tier or set the number of IoT Hub units.
50+
51+
* **IP Filter**: Specify a range of IP addresses for the IoT hub to accept or reject.
52+
53+
* **Properties**: A list of properties that you can copy and use elsewhere, such as the resource ID, resource group, location, and so on.
54+
55+
### [Azure portal](#tab/portal)
56+
57+
### [Azure CLI](#tab/cli)
58+
59+
Use the [az iot hub update](/cli/azure/iot/hub#az-iot-hub-update) command to make changes to an existing IoT hub.
60+
61+
---
62+
63+
## Connect to an IoT hub
64+
65+
Provide access permissions to applications and services that use IoT Hub functionality.
66+
67+
### Connect with a connection string
68+
69+
Connection strings are an easy way to get started with IoT Hub, and are used in many samples and tutorials, but aren't recommended for production scenarios.
70+
71+
Shared access policies define permissions for devices and services to connect to IoT Hub. The built-in policies provide one or more of the following permissions. You should always provide the least necessary permissions for a given scenario.
72+
73+
* The **Registry Read** and **Registry Write** permissions grant read and write access rights to the identity registry. These permissions are used by back-end cloud services to manage device identities.
74+
75+
* The **Service Connect** permission grants permission to access service endpoints. This permission is used by back-end cloud services to send and receive messages from devices. It's also used to update and read device twin and module twin data.
76+
77+
* The **Device Connect** permission grants permissions for sending and receiving messages using the IoT Hub device-side endpoints. This permission is used by devices to send and receive messages from an IoT hub or update and read device twin and module twin data. It's also used for file uploads.
78+
79+
For information about the access granted by specific permissions, see [IoT Hub permissions](./iot-hub-dev-guide-sas.md#access-control-and-permissions).
80+
81+
82+
#### [Azure portal](#tab/portal)
83+
84+
To get the IoT Hub connection string for the **service** policy, follow these steps:
85+
86+
1. In the [Azure portal](https://portal.azure.com), select **Resource groups**. Select the resource group where your hub is located, and then select your hub from the list of resources.
87+
88+
1. On the left-side pane of your IoT hub, select **Shared access policies**.
89+
90+
1. From the list of policies, select the **service** policy.
91+
92+
1. Copy the **Primary connection string** and save the value.
93+
94+
95+
#### [Azure CLI](#tab/cli)
96+
97+
IoT hubs are created with several default access policies. One such policy is the **service** policy, which provides sufficient permissions for a service to read and write the IoT hub's endpoints. Run the following command to get a connection string for your IoT hub that adheres to the service policy:
98+
99+
```azurecli-interactive
100+
az iot hub connection-string show --hub-name YOUR_IOT_HUB_NAME --policy-name service
101+
```
102+
103+
The service connection string should look similar to the following example:
104+
105+
```javascript
106+
"HostName=<IOT_HUB_NAME>.azure-devices.net;SharedAccessKeyName=service;SharedAccessKey=<SHARED_ACCESS_KEY>"
107+
```
108+
109+
---
110+
111+
### Connect with role assignments
112+
113+
In production scenarios, we recommend using Microsoft Entra ID and Azure role-based access control (Azure RBAC) for connecting to IoT Hub. For more information, see [Control access to IoT Hub by using Microsoft Entra ID](./authenticate-authorize-azure-ad.md).
114+
115+
## Delete an IoT hub
116+
117+
### [Azure portal](#tab/portal)
118+
119+
To delete an IoT hub, open your IoT hub in the Azure portal, then choose **Delete**.
120+
121+
:::image type="content" source="./media/iot-hub-create-through-portal/delete-iot-hub.png" alt-text="Screenshot showing where to find the delete button for an IoT hub in the Azure portal." lightbox="./media/iot-hub-create-through-portal/delete-iot-hub.png":::
122+
123+
### [Azure CLI](#tab/cli)
124+
125+
To [delete an IoT hub](/cli/azure/iot/hub#az-iot-hub-delete), run the following command:
126+
127+
```azurecli-interactive
128+
az iot hub delete --name {your iot hub name} -\
129+
-resource-group {your resource group name}
130+
```
131+
132+
---
133+
134+
## Next steps
135+
136+
Learn more about managing Azure IoT Hub:
137+
138+
* [Message routing with IoT Hub](how-to-routing-portal.md)
139+
* [Monitor your IoT hub](monitor-iot-hub.md)

articles/iot-hub/iot-hub-create-through-portal.md

Lines changed: 0 additions & 64 deletions
This file was deleted.

articles/iot-hub/iot-hub-create-use-iot-toolkit.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ ms.author: junhan
77
ms.service: iot-hub
88
ms.topic: how-to
99
ms.date: 01/04/2019
10+
robots: NOINDEX
1011
---
1112

1213
# Create an IoT hub using the Azure IoT Hub extension for Visual Studio Code
@@ -57,13 +58,3 @@ The following steps show how to create an IoT hub in Visual Studio Code (VS Code
5758

5859
> [!TIP]
5960
> There is no option to delete your IoT hub in Visual Studio Code, however you can [delete your hub in the Azure portal](iot-hub-create-through-portal.md#delete-an-iot-hub).
60-
61-
## Next steps
62-
63-
Now that you've deployed an IoT hub using the Azure IoT Hub extension for Visual Studio Code, explore these articles:
64-
65-
- [Use the Azure IoT Hub extension for Visual Studio Code to send and receive messages between your device and an IoT hub](iot-hub-vscode-iot-toolkit-cloud-device-messaging.md).
66-
67-
- [Use the Azure IoT Hub extension for Visual Studio Code for Azure IoT Hub device management](iot-hub-device-management-iot-toolkit.md)
68-
69-
- [See the Azure IoT Hub extension for Visual Studio Code wiki page](https://github.com/microsoft/vscode-azure-iot-toolkit/wiki).

articles/iot-hub/iot-hub-create-using-cli.md

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -60,30 +60,11 @@ You can change the settings of an existing IoT hub after it's created. Here are
6060

6161
For a complete list of options to update an IoT hub, see the [**az iot hub update** commands](/cli/azure/iot/hub#az-iot-hub-update) reference page.
6262

63-
## Register a new device in the IoT hub
64-
65-
In this section, you create a device identity in the identity registry in your IoT hub. A device can't connect to a hub unless it has an entry in the identity registry. For more information, see [Understand the identity registry in your IoT hub](iot-hub-devguide-identity-registry.md). This device identity is [IoT Edge](../iot-edge/index.yml) enabled.
66-
67-
Run the following command to create a device identity. Use your IoT hub name and create a new device ID name in place of `{iothub_name}` and `{device_id}`. This command creates a device identity with default authorization (shared private key).
68-
69-
```azurecli-interactive
70-
az iot hub device-identity create -n {iothub_name} -d {device_id} --ee
71-
```
72-
73-
The result is a JSON printout which includes your keys and other information.
74-
75-
Alternatively, there are several options to register a device using different kinds of authorization. To explore the options, see [Examples](/cli/azure/iot/hub/device-identity#az-iot-hub-device-identity-create-examples) on the **az iot hub device-identity** reference page.
76-
7763
## Remove an IoT hub
7864

7965
There are various commands to [delete an individual resource](/cli/azure/resource), such as an IoT hub.
8066

81-
To [delete an IoT hub](/cli/azure/iot/hub#az-iot-hub-delete), run the following command:
8267

83-
```azurecli-interactive
84-
az iot hub delete --name {your iot hub name} -\
85-
-resource-group {your resource group name}
86-
```
8768

8869
## Next steps
8970

articles/iot-hub/iot-hubs-manage-device-twin-tags.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,4 @@ To try out some of the concepts described in this article, see the following IoT
159159
160160
* [How to use the device twin](device-twins-node.md)
161161
* [How to use device twin properties](tutorial-device-twins.md)
162-
* [Device management with the Azure IoT Hub extension for VS Code](iot-hub-device-management-iot-toolkit.md)
162+

articles/iot-hub/quickstart-send-telemetry-cli.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ Azure CLI requires you to be logged into your Azure account. All communication b
7373

7474
In this section, you use the Azure CLI to create a resource group and an IoT hub. An Azure resource group is a logical container into which Azure resources are deployed and managed. An IoT hub acts as a central message hub for bi-directional communication between your IoT application and the devices.
7575

76-
> [!TIP]
77-
> Optionally, you can create an Azure resource group, an IoT hub, and other resources by using the [Azure portal](iot-hub-create-through-portal.md), [Visual Studio Code](iot-hub-create-use-iot-toolkit.md), or other programmatic methods.
78-
7976
1. In the first CLI session, run the [az group create](/cli/azure/group#az-group-create) command to create a resource group. The following command creates a resource group named *MyResourceGroup* in the *eastus* location.
8077

8178
```azurecli

0 commit comments

Comments
 (0)