+
+
+
+ 1. Enter the directory `azure-sdk-for-c/sdk/samples/iot/`.
+ 2. Run the following commands:
+
+ ```bash
+ openssl ecparam -out device_ec_key.pem -name prime256v1 -genkey
+ openssl req -new -days 1 -nodes -x509 -key device_ec_key.pem -out device_ec_cert.pem -config x509_config.cfg -subj "/CN=paho-sample-device1"
+ openssl x509 -noout -text -in device_ec_cert.pem
+
+ rm -f device_cert_store.pem
+ cat device_ec_cert.pem device_ec_key.pem > device_cert_store.pem
+
+ openssl x509 -noout -fingerprint -in device_ec_cert.pem | sed 's/://g'| sed 's/\(SHA1 Fingerprint=\)//g' | tee fingerprint.txt
+
+ export AZ_IOT_DEVICE_X509_CERT_PEM_FILE_PATH=$(pwd)/device_cert_store.pem
+ ```
+
+ 3. The resulting thumbprint will be placed in `fingerprint.txt` and the generated pem file is named `device_ec_cert.pem`.
+
+
+
+ 1. Enter the directory `azure-sdk-for-c\sdk\samples\iot\`.
+ 2. Run the following commands:
+
+ ```powershell
+ openssl ecparam -out device_ec_key.pem -name prime256v1 -genkey
+ openssl req -new -days 1 -nodes -x509 -key device_ec_key.pem -out device_ec_cert.pem -config x509_config.cfg -subj "/CN=paho-sample-device1"
+ openssl x509 -noout -text -in device_ec_cert.pem
+
+ Get-Content device_ec_cert.pem, device_ec_key.pem | Set-Content device_cert_store.pem
+
+ openssl x509 -noout -fingerprint -in device_ec_cert.pem | % {$_.replace(":", "")} | % {$_.replace("SHA1 Fingerprint=", "")} | Tee-Object fingerprint.txt
+
+ $env:AZ_IOT_DEVICE_X509_CERT_PEM_FILE_PATH=$(Resolve-Path device_cert_store.pem)
+ ```
+ 3. The resulting thumbprint will be placed in `fingerprint.txt` and the generated pem file is named `device_ec_cert.pem`.
+
+ Linux:
+ Windows (PowerShell):
+
-
-1. In your Azure IoT Hub, add a new device using a self-signed certificate. See [here](https://docs.microsoft.com/azure/iot-hub/iot-hub-security-x509-get-started#create-an-x509-device-for-your-iot-hub) for further instruction, with one exception--**DO NOT** select X.509 CA Signed as the authentication type. Select **X.509 Self-Signed**.
-
- For the Thumbprint, use the recently generated fingerprint, which has been placed in the file `fingerprint.txt`.
-
-2. Set the following environment variables:
-
- - `AZ_IOT_HUB_DEVICE_ID`: Select your device from the IoT Devices page and copy its Device Id.
- - `AZ_IOT_HUB_HOSTNAME`: Copy the Hostname from the Overview tab in your Azure IoT Hub.
-
- Linux:
-
- ```bash
- export AZ_IOT_HUB_DEVICE_ID=
-1. In your Azure IoT Hub, add a new device using a symmetric key. See [here](https://docs.microsoft.com/azure/iot-hub/iot-hub-create-through-portal#register-a-new-device-in-the-iot-hub) for further instruction.
-
-2. Set the following environment variables:
-
- - `AZ_IOT_HUB_SAS_DEVICE_ID`: Select your device from the IoT Devices page and copy its Device Id.
- - `AZ_IOT_HUB_SAS_KEY`: Copy its Primary Key from the same page.
- - `AZ_IOT_HUB_HOSTNAME`: Copy the Hostname from the Overview tab in your Azure IoT Hub.
-
- Linux:
-
- ```bash
- export AZ_IOT_HUB_SAS_DEVICE_ID=
-
-1. In your Azure IoT Hub DPS, add a new individual device enrollment using the recently generated `device_ec_cert.pem` file. See [here](https://docs.microsoft.com/azure/iot-dps/quick-create-simulated-device-x509#create-a-device-enrollment-entry-in-the-portal) for further instruction. After creation, the Registration ID of your device should appear as `paho-sample-device1` in the Individual Enrollments tab.
-
-2. Set the following environment variables:
-
- - `AZ_IOT_PROVISIONING_REGISTRATION_ID`: This should be `paho-sample-device1`.
- - `AZ_IOT_PROVISIONING_ID_SCOPE`: Copy the Id Scope from the Overview tab in your Azure IoT Hub DPS.
-
- Linux:
-
- ```bash
- export AZ_IOT_PROVISIONING_REGISTRATION_ID=
-
-1. In your Azure IoT Hub DPS, add a new individual device enrollment using a symmetric key. See [here](https://docs.microsoft.com/azure/iot-dps/quick-create-simulated-device-symm-key#create-a-device-enrollment-entry-in-the-portal) for further instruction. After creation, the Registration ID of your device will appear in the Individual Enrollments tab.
-
-2. Set the following environment variables:
-
- - `AZ_IOT_PROVISIONING_SAS_REGISTRATION_ID`: Copy the Registration Id of your SAS device from the Individual Enrollments tab.
- - `AZ_IOT_PROVISIONING_SAS_KEY`: Select your SAS device from the Individual Enrollments tab and copy its Primary Key.
- - `AZ_IOT_PROVISIONING_ID_SCOPE`: Copy the Id Scope from the Overview tab in your Azure IoT Hub DPS.
-
- Linux:
-
- ```bash
- export AZ_IOT_PROVISIONING_SAS_REGISTRATION_ID=