Skip to content

Commit 8a785c2

Browse files
committed
Add screenshots
1 parent 4726dfd commit 8a785c2

File tree

3 files changed

+28
-22
lines changed

3 files changed

+28
-22
lines changed

articles/iot-hub/create-connect-device.md

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
title: Register and connect an IoT device
33
titleSuffix: Azure IoT Hub
4-
description: How to create, manage, and delete Azure IoT devices and how to retrieve their connection information.
4+
description: How to create, manage, and delete Azure IoT devices and how to retrieve the device connection string.
55
author: kgremban
66

77
ms.author: kgremban
88
ms.service: iot-hub
99
ms.topic: how-to
10-
ms.date: 06/12/2024
10+
ms.date: 06/19/2024
1111
---
1212

1313
# Create and manage device identities
@@ -16,10 +16,12 @@ Create a device identity for your device to connect to Azure IoT Hub. This artic
1616

1717
## Prerequisites
1818

19-
* An IoT hub in your subscription. If you don't have an IoT hub, follow the steps in [Create an IoT hub](./iot-hub-create-through-portal.md)
19+
* An IoT hub in your subscription. If you don't have an IoT hub, follow the steps in [create an IoT hub](./iot-hub-create-through-portal.md).
2020

2121
* 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).
2222

23+
* If your IoT hub is managed with role-based access control (RBAC), then you need **Read/Write/Delete Device/Module** permissions for the steps in this article. Those permissions are included in [IoT Hub Registry Contributor](../role-based-access-control/built-in-roles/internet-of-things.md#iot-hub-registry-contributor) role.
24+
2325
## Register a device
2426

2527
In this section, you create a device identity in the [identity registry in your IoT hub](./iot-hub-devguide-identity-registry.md). A device can't connect to a hub unless it has a device identity.
@@ -42,15 +44,15 @@ When you register a device, you choose its authentication method. IoT Hub suppor
4244

4345
### Prepare certificates
4446

45-
If you're using either of the X.509 certificate authentication methods, make sure your certificates are ready before registering a device.
47+
If you're using either of the X.509 certificate authentication methods, make sure your certificates are ready before registering a device:
4648

47-
The tutorial [Create and upload certificates for testing](./tutorial-x509-test-certs.md) provides a good introduction for how to create CA-signed certificates and upload them to IoT Hub. After completing that tutorial, you're ready to register a device with **X.509 CA signed** authentication.
49+
* For CA-signed certificates, the tutorial [Create and upload certificates for testing](./tutorial-x509-test-certs.md) provides a good introduction for how to create CA-signed certificates and upload them to IoT Hub. After completing that tutorial, you're ready to register a device with **X.509 CA signed** authentication.
4850

49-
If your device uses self-signed certificates, then you need two device certificates (a primary and a secondary certificate) on the device and thumbprints for both to upload to IoT Hub. One way to retrieve the thumbprint from a certificate is with the following OpenSSL command:
51+
* For self-signed certificates, you need two device certificates (a primary and a secondary certificate) on the device and thumbprints for both to upload to IoT Hub. One way to retrieve the thumbprint from a certificate is with the following OpenSSL command:
5052

51-
```bash
52-
openssl x509 -in <certificate filename>.pem -text -fingerprint
53-
```
53+
```bash
54+
openssl x509 -in <certificate filename>.pem -text -fingerprint
55+
```
5456

5557
### Add a device
5658

@@ -64,6 +66,8 @@ Create a device identity in your IoT hub.
6466

6567
1. Select **Add Device** to add a device in your IoT hub.
6668

69+
:::image type="content" source="./media/create-connect-device/add-device.png" alt-text="Screenshot that shows adding a new device in the Azure portal.":::
70+
6771
1. In **Create a device**, provide the information for your new device identity:
6872

6973
| Parameter | Dependent parameter | Value |
@@ -95,25 +99,17 @@ The following table describes common parameters used with this command.
9599

96100
---
97101

98-
## Retrieve device connection information
99-
100-
Registered devices have multiple ways to connect to IoT Hub, depending on the SDK and authentication method. For specific information, refer to the [Azure IoT Hub device SDKs](./iot-hub-devguide-sdks.md#azure-iot-hub-device-sdks).
102+
## Retrieve device connection string
101103

102-
For samples and test scenarios, the most common connection method is to use a *device connection string*. A device connection string contains the name of the IoT hub, the name of the device, and the device's authentication information.
104+
For samples and test scenarios, the most common connection method is to use symmetric key authentication and connect with a *device connection string*. A device connection string contains the name of the IoT hub, the name of the device, and the device's authentication information.
103105

104-
Device with symmetric key authentication have a connection string with the following pattern:
106+
For information about other methods for connecting devices, particularly for X.509 authentication, refer to the [Azure IoT Hub device SDKs](./iot-hub-devguide-sdks.md#azure-iot-hub-device-sdks).
105107

106-
`HostName=<IOT_HUB_NAME>;DeviceId=<DEVICE_NAME>;SharedAccessKey=<PRIMARY_OR_SECONDARY_KEY>`
107-
108-
Devices with X.509 authentication, either self-signed or CA-signed, usually don't use connection strings for authentication. When they do, their connection strings take the following pattern:
109-
110-
`HostName=<IOT_HUB_NAME>;DeviceId=<DEVICE_NAME>;x509=true`
111-
112-
You can build a connection string yourself with those three pieces of connection information, or you can retrieve it with the following steps.
108+
Use the following steps to retrieve a device connection string.
113109

114110
### [Azure portal](#tab/portal)
115111

116-
The Azure portal only lists connection strings for devices that use symmetric key authentication.
112+
The Azure portal provides device connection strings only for devices that use symmetric key authentication.
117113

118114
1. In the [Azure portal](https://portal.azure.com), navigate to your IoT hub.
119115

@@ -123,6 +119,8 @@ The Azure portal only lists connection strings for devices that use symmetric ke
123119

124120
1. Copy the value of **Primary connection string**.
125121

122+
:::image type="content" source="./media/create-connect-device/copy-connection-string.png" alt-text="Screenshot that shows copying the value of the primary connection string from the Azure portal.":::
123+
126124
By default, the keys and connection strings are masked because they're sensitive information. If you click the eye icon, they're revealed. It's not necessary to reveal them to copy them with the copy button.
127125

128126
### [Azure CLI](#tab/cli)
@@ -135,6 +133,14 @@ az iot hub device-identity connection-string show --device-id <DEVICE_NAME> --hu
135133

136134
---
137135

136+
Devices with symmetric key authentication have a device connection string with the following pattern:
137+
138+
`HostName=<IOT_HUB_NAME>;DeviceId=<DEVICE_NAME>;SharedAccessKey=<PRIMARY_OR_SECONDARY_KEY>`
139+
140+
Devices with X.509 authentication, either self-signed or CA-signed, usually don't use device connection strings for authentication. When they do, their connection strings take the following pattern:
141+
142+
`HostName=<IOT_HUB_NAME>;DeviceId=<DEVICE_NAME>;x509=true`
143+
138144
## Disable or delete a device
139145

140146
If you want to keep a device in your IoT hub's identity registry, but want to prevent it from connecting then you can change its status to *disabled.*
92.1 KB
Loading
46.7 KB
Loading

0 commit comments

Comments
 (0)