Skip to content

Commit df1bfcd

Browse files
committed
Added certificate steps to device section
1 parent e5d467a commit df1bfcd

5 files changed

+55
-18
lines changed

articles/iot-hub/how-to-device-management.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ manager: lizross
88
ms.service: azure-iot-hub
99
ms.devlang: csharp
1010
ms.topic: how-to
11-
ms.date: 11/25/2024
11+
ms.date: 1/6/2025
1212
zone_pivot_groups: iot-hub-howto-c2d-1
1313
---
1414

includes/iot-hub-howto-device-management-dotnet.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.author: kgremban
77
ms.service: iot-hub
88
ms.devlang: csharp
99
ms.topic: include
10-
ms.date: 11/25/2024
10+
ms.date: 1/6/2025
1111
ms.custom: mqtt, devx-track-csharp, devx-track-dotnet
1212
---
1313

@@ -21,9 +21,7 @@ This article describes how to use the [Azure IoT SDK for .NET](https://github.co
2121

2222
This section describes how to use device application code to create a direct method callback listener.
2323

24-
[!INCLUDE [iot-authentication-device-connection-string.md](iot-authentication-device-connection-string.md)]
25-
26-
### Required device NuGet package
24+
### Required device NuGet packages
2725

2826
Device client applications written in C# require the **Microsoft.Azure.Devices.Client** NuGet package.
2927

@@ -34,7 +32,16 @@ using Microsoft.Azure.Devices.Client;
3432
using Microsoft.Azure.Devices.Shared;
3533
```
3634

37-
### Connect to a device
35+
### Connect a device to IoT Hub
36+
37+
A device app can authenticate with IoT Hub using the following methods:
38+
39+
* Shared access key
40+
* X.509 certificate
41+
42+
[!INCLUDE [iot-authentication-device-connection-string.md](iot-authentication-device-connection-string.md)]
43+
44+
#### Authenticate using a shared access key
3845

3946
The [DeviceClient](/dotnet/api/microsoft.azure.devices.client.deviceclient) class exposes all the methods required to interact with device messages from the device.
4047

@@ -59,6 +66,10 @@ deviceClient = DeviceClient.CreateFromConnectionString(DeviceConnectionString,
5966
TransportType.Mqtt);
6067
```
6168

69+
#### Authenticate using an X.509 certificate
70+
71+
[!INCLUDE [iot-hub-howto-auth-device-cert-dotnet](iot-hub-howto-auth-device-cert-dotnet.md)]
72+
6273
### Create a direct method callback listener
6374

6475
Use [SetMethodHandlerAsync](/dotnet/api/microsoft.azure.devices.client.deviceclient.setmethodhandlerasync) to initialize a direct method callback listener. The listener is associated with a method name keyword, such as "reboot". The method name can be used in an IoT Hub or backend application to trigger the callback method on the device.

includes/iot-hub-howto-device-management-java.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.author: kgremban
77
ms.service: iot-hub
88
ms.devlang: csharp
99
ms.topic: include
10-
ms.date: 11/25/2024
10+
ms.date: 1/6/2025
1111
ms.custom: amqp, mqtt, devx-track-java, devx-track-extended-java
1212
---
1313

includes/iot-hub-howto-device-management-node.md

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.author: kgremban
77
ms.service: iot-hub
88
ms.devlang: csharp
99
ms.topic: include
10-
ms.date: 11/25/2024
10+
ms.date: 1/6/2025
1111
ms.custom: mqtt, devx-track-js
1212
---
1313

@@ -21,15 +21,30 @@ This article describes how to use the [Azure IoT SDK for Node.js](https://github
2121

2222
This section describes how to use device application code to create a direct method callback.
2323

24-
### Install SDK packages
24+
### Install SDK package
2525

2626
The [azure-iot-device](/javascript/api/azure-iot-device) package contains objects that interface with IoT devices. Run this command to install the **azure-iot-device** device SDK on your development machine:
2727

2828
```cmd/sh
2929
npm install azure-iot-device --save
3030
```
3131

32-
### Choose a transport protocol
32+
### Connect a device to IoT Hub
33+
34+
A device app can authenticate with IoT Hub using the following methods:
35+
36+
* X.509 certificate
37+
* Shared access key
38+
39+
[!INCLUDE [iot-authentication-device-connection-string.md](iot-authentication-device-connection-string.md)]
40+
41+
#### Authenticate using an X.509 certificate
42+
43+
[!INCLUDE [iot-hub-howto-auth-device-cert-node](iot-hub-howto-auth-device-cert-node.md)]
44+
45+
#### Authenticate using a shared access key
46+
47+
##### Choose a transport protocol
3348

3449
The `Client` object supports these protocols:
3550

@@ -49,7 +64,7 @@ npm install azure-iot-device-amqp --save
4964

5065
For more information about the differences between MQTT, AMQP, and HTTPS support, see [Cloud-to-device communications guidance](../articles/iot-hub/iot-hub-devguide-c2d-guidance.md) and [Choose a communication protocol](../articles/iot-hub/iot-hub-devguide-protocols.md).
5166

52-
### Create a client object
67+
##### Create a client object
5368

5469
Create a `Client` object using the installed package.
5570

@@ -59,7 +74,7 @@ For example:
5974
const Client = require('azure-iot-device').Client;
6075
```
6176

62-
### Create a protocol object
77+
##### Create a protocol object
6378

6479
Create a `Protocol` object using an installed transport package.
6580

@@ -69,7 +84,7 @@ This example assigns the AMQP protocol:
6984
const Protocol = require('azure-iot-device-amqp').Amqp;
7085
```
7186

72-
### Add the device connection string and transport protocol
87+
##### Add the device connection string and transport protocol
7388

7489
Call [fromConnectionString](/javascript/api/azure-iot-device/client?#azure-iot-device-client-fromconnectionstring) to supply device connection parameters:
7590

@@ -84,7 +99,7 @@ const Protocol = require('azure-iot-device-mqtt').Amqp;
8499
let client = Client.fromConnectionString(deviceConnectionString, Protocol);
85100
```
86101

87-
### Open the connection to IoT Hub
102+
##### Open the connection to IoT Hub
88103

89104
Use the [open](/javascript/api/azure-iot-device/client?#azure-iot-device-client-open) method to open connection between an IoT device and IoT Hub.
90105

includes/iot-hub-howto-device-management-python.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.author: kgremban
77
ms.service: iot-hub
88
ms.devlang: csharp
99
ms.topic: include
10-
ms.date: 11/25/2024
10+
ms.date: 1/6/2025
1111
ms.custom: mqtt, devx-track-python, py-fresh-zinc
1212
---
1313

@@ -35,9 +35,9 @@ pip install azure-iot-hub
3535

3636
This section describes how to use device application code to create a direct method callback listener.
3737

38-
[!INCLUDE [iot-authentication-device-connection-string.md](iot-authentication-device-connection-string.md)]
38+
The [IoTHubDeviceClient](/python/api/azure-iot-device/azure.iot.device.iothubdeviceclient) class contains methods that can be used to work with direct methods.
3939

40-
### Device import statements
40+
### Device import statement
4141

4242
Add this import statement to access `IoTHubDeviceClient` and `MethodResponse`.
4343

@@ -48,7 +48,14 @@ from azure.iot.device import IoTHubDeviceClient, MethodResponse
4848

4949
### Connect to a device
5050

51-
The [IoTHubDeviceClient](/python/api/azure-iot-device/azure.iot.device.iothubdeviceclient) class contains methods that can be used to work with direct methods.
51+
A device app can authenticate with IoT Hub using the following methods:
52+
53+
* Shared access key
54+
* X.509 certificate
55+
56+
[!INCLUDE [iot-authentication-device-connection-string.md](iot-authentication-device-connection-string.md)]
57+
58+
#### Authenticate using a shared access key
5259

5360
Use [create_from_connection_string](/python/api/azure-iot-device/azure.iot.device.iothubdeviceclient?#azure-iot-device-iothubdeviceclient-create-from-connection-string) to connect an application to a device using a device connection string.
5461

@@ -59,6 +66,10 @@ conn_str = "{IoT hub device connection string}"
5966
device_client = IoTHubDeviceClient.create_from_connection_string(conn_str)
6067
```
6168

69+
#### Authenticate using an X.509 certificate
70+
71+
[!INCLUDE [iot-hub-howto-auth-device-cert-python](iot-hub-howto-auth-device-cert-python.md)]
72+
6273
### Create a direct method callback
6374

6475
Use [on_method_request_received](/python/api/azure-iot-device/azure.iot.device.iothubdeviceclient?#azure-iot-device-iothubdeviceclient-on-method-request-received) to create a handler function or coroutine that is called when a direct method is received. The listener is associated with a method name keyword, such as "reboot". The method name can be used in an IoT Hub or backend application to trigger the callback method on the device.

0 commit comments

Comments
 (0)