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
To connect a device to IoT Hub using an X.509 certificate:
16
16
17
-
1. Use [DeviceAuthenticationWithX509Certificate](/dotnet/api/microsoft.azure.devices.client.deviceauthenticationwithx509certificate) to create an object that contains device and certificate information that is passed as the second parameter to `DeviceClient.Create` (step 2).
17
+
1. Use [DeviceAuthenticationWithX509Certificate](/dotnet/api/microsoft.azure.devices.client.deviceauthenticationwithx509certificate) to create an object that contains device and certificate information. `DeviceAuthenticationWithX509Certificate` is passed as the second parameter to `DeviceClient.Create` (step 2).
18
18
19
-
1. Use [DeviceClient.Create](/dotnet/api/microsoft.azure.devices.client.deviceclient.create?#microsoft-azure-devices-client-deviceclient-create(system-string-microsoft-azure-devices-client-iauthenticationmethod)) to connect the device to IoT Hub using an X.509 certificate.
19
+
1. Use [DeviceClient.Create](/dotnet/api/microsoft.azure.devices.client.deviceclient.create?view=azure-dotnet&branch=main#microsoft-azure-devices-client-deviceclient-create(system-string-microsoft-azure-devices-client-iauthenticationmethod-microsoft-azure-devices-client-transporttype)) to connect the device to IoT Hub using an X.509 certificate.
20
20
21
-
This example shows certificate input parameter values as local variables for clarity. In a production system, store sensitive input parameters in environment variables or another more secure storage location. For example, use `Environment.GetEnvironmentVariable("HOSTNAME")` to read the host name environment variable.
22
-
23
-
In this example, the device and certificate information populated `auth``DeviceAuthenticationWithX509Certificate` object is passed as to `DeviceClient.Create`. An example of `DeviceAuthenticationWithX509Certificate` information population is omitted because of the flexible nature of how the certificate information can be added.
21
+
In this example, the device and certificate information has been populated in the `auth``DeviceAuthenticationWithX509Certificate` object that is passed to `DeviceClient.Create`. An example of `DeviceAuthenticationWithX509Certificate` information population is omitted because of the flexible nature of how the certificate information can be added.
24
22
25
23
```csharp
26
24
HostName="xxxxx.azure-devices.net";
@@ -33,10 +31,11 @@ using var deviceClient = DeviceClient.Create(
33
31
For more information about certificate authentication, see:
34
32
35
33
*[Authenticate identities with X.509 certificates](/azure/iot-hub/authenticate-authorize-x509)
36
-
*[Create and upload certificates for testing](/azure/iot-hub/tutorial-x509-test-certs)
34
+
*[Tutorial: Create and upload certificates for testing](/azure/iot-hub/tutorial-x509-test-certs)
Copy file name to clipboardExpand all lines: includes/iot-hub-howto-auth-device-cert-java.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ ms.date: 12/12/2024
13
13
14
14
To connect a device to IoT Hub using an X.509 certificate:
15
15
16
-
1. Build the [SSLContext](https://docs.oracle.com/javase/8/docs/api/javax/net/ssl/SSLContext.html) object using [buildSSLContext](https://hc.apache.org/httpcomponents-core-4.4.x/current/httpcore/apidocs/org/apache/http/ssl/SSLContextBuilder.html)
16
+
1. Build the [SSLContext](https://docs.oracle.com/javase/8/docs/api/javax/net/ssl/SSLContext.html) object using [buildSSLContext](https://hc.apache.org/httpcomponents-core-4.4.x/current/httpcore/apidocs/org/apache/http/ssl/SSLContextBuilder.html).
17
17
1. Add the `SSLContext` information to a [ClientOptions](/java/api/com.microsoft.azure.sdk.iot.device.clientoptions) object.
18
18
1. Call [DeviceClient](/java/api/com.microsoft.azure.sdk.iot.device.deviceclient?#com-microsoft-azure-sdk-iot-device-deviceclient-deviceclient(java-lang-string-com-microsoft-azure-sdk-iot-device-iothubclientprotocol-com-microsoft-azure-sdk-iot-device-clientoptions)) using the `ClientOptions` information to create the device-to-IoT Hub connection.
Copy file name to clipboardExpand all lines: includes/iot-hub-howto-auth-device-cert-node.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,9 @@ For more information about certificate authentication, see:
41
41
42
42
*[Authenticate identities with X.509 certificates](/azure/iot-hub/authenticate-authorize-x509)
43
43
*[Create and upload certificates for testing](/azure/iot-hub/tutorial-x509-test-certs)
44
+
*[Tutorial: Provision multiple X.509 devices using enrollment groups](/azure/iot-dps/tutorial-custom-hsm-enrollment-group-x509?pivots=programming-language-nodejs)
45
+
*[OpenSSL CA](https://openssl-ca.readthedocs.io/)
44
46
45
47
##### Code samples
46
48
47
-
For a working sample of device X.509 certificate authentication, see [Simple sample device X.509](https://github.com/Azure/azure-iot-sdk-node/blob/main/device/samples/javascript/simple_sample_device_x509.js).
49
+
For a working sample of device X.509 certificate authentication, see [Simple sample device X.509](https://github.com/Azure/azure-iot-sdk-node/blob/main/device/samples/javascript/simple_sample_device_x509.js).
Copy file name to clipboardExpand all lines: includes/iot-hub-howto-auth-device-cert-python.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ ms.manager: lizross
11
11
ms.date: 12/06/2024
12
12
---
13
13
14
-
To connect a device to IoT Hub:
14
+
To connect a device to IoT Hub using an X.509 certificate:
15
15
16
16
1. Use [create_from_x509_certificate](/python/api/azure-iot-device/azure.iot.device.iothubdeviceclient?#azure-iot-device-iothubdeviceclient-create-from-x509-certificate) to add the X.509 certificate parameters
17
17
@@ -50,8 +50,10 @@ await device_client.connect()
50
50
For more information about certificate authentication, see:
51
51
52
52
*[Authenticate identities with X.509 certificates](/azure/iot-hub/authenticate-authorize-x509)
53
-
*[Create and upload certificates for testing](/azure/iot-hub/tutorial-x509-test-certs)
53
+
*[Tutorial: Create and upload certificates for testing](/azure/iot-hub/tutorial-x509-test-certs)
54
+
*[Tutorial: Provision multiple X.509 devices using enrollment groups](/azure/iot-dps/tutorial-custom-hsm-enrollment-group-x509?pivots=programming-language-python)
55
+
*[OpenSSL CA](https://openssl-ca.readthedocs.io/)
54
56
55
57
##### Code samples
56
58
57
-
For working samples of device X.509 certificate authentication, see the examples whose file names end in X.509 at [Async hub scenarios](https://github.com/Azure/azure-iot-sdk-python/tree/main/samples/async-hub-scenarios).
59
+
For working samples of device X.509 certificate authentication, see the examples whose file names end in x509 at [Async hub scenarios](https://github.com/Azure/azure-iot-sdk-python/tree/main/samples/async-hub-scenarios).
0 commit comments