Skip to content

Commit 4f3fc23

Browse files
authored
Merge pull request #287622 from kgremban/sep30-ropc
ROPC - IoT Hub device and service connstring notes
2 parents 25b4240 + eaf49cc commit 4f3fc23

15 files changed

+53
-6
lines changed

articles/iot-hub/device-management-dotnet.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ In this section, you:
4444

4545
* Use the reported properties to enable device twin queries to identify devices and when they were last rebooted.
4646

47+
[!INCLUDE [iot-authentication-device-connection-string.md](../../includes/iot-authentication-device-connection-string.md)]
48+
4749
To create the simulated device app, follow these steps:
4850

4951
1. Open Visual Studio and select **Create a new project**, then find and select the **Console App (.NET Framework)** project template, then select **Next**.
@@ -156,6 +158,9 @@ To create the simulated device app, follow these steps:
156158

157159
In this section, you create a .NET console app, using C#, that initiates a remote reboot on a device using a direct method. The app uses device twin queries to discover the last reboot time for that device.
158160

161+
[!INCLUDE [iot-authentication-service-connection-string.md](../../includes/iot-authentication-service-connection-string.md)]
162+
163+
159164
1. Open Visual Studio and select **Create a new project**.
160165

161166
1. In **Create a new project**, find and select the **Console App (.NET Framework)** project template, and then select **Next**.

articles/iot-hub/device-management-java.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ This article shows you how to create:
4343

4444
In this section, you create a Java console app that simulates a device. The app listens for the reboot direct method call from your IoT hub and immediately responds to that call. The app then sleeps for a while to simulate the reboot process before it uses a reported property to notify the **trigger-reboot** back-end app that the reboot is complete.
4545

46+
[!INCLUDE [iot-authentication-device-connection-string.md](../../includes/iot-authentication-device-connection-string.md)]
47+
4648
1. In the **dm-get-started** folder, create a Maven project called **simulated-device** using the following command at your command prompt:
4749

4850
```cmd/sh
@@ -277,6 +279,8 @@ In this section, you create a Java console app that:
277279
278280
3. Polls the reported properties sent from the device to determine when the reboot is complete.
279281
282+
[!INCLUDE [iot-authentication-service-connection-string.md](../../includes/iot-authentication-service-connection-string.md)]
283+
280284
This console app connects to your IoT Hub to invoke the direct method and read the reported properties.
281285
282286
1. Create an empty folder called **dm-get-started**.

articles/iot-hub/device-management-node.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ In this section, you:
4444

4545
* Use the reported properties to enable device twin queries to identify devices and when they last rebooted.
4646

47+
[!INCLUDE [iot-authentication-device-connection-string.md](../../includes/iot-authentication-device-connection-string.md)]
48+
4749
1. Create an empty folder called **managed-device**. In the **managed-device** folder, create a package.json file using the following command at your command prompt. Accept all the defaults:
4850

4951
```cmd/sh
@@ -144,6 +146,8 @@ In this section, you:
144146
145147
In this section, you create a Node.js console app that initiates a remote reboot on a device using a direct method. The app uses device twin queries to discover the last reboot time for that device.
146148
149+
[!INCLUDE [iot-authentication-service-connection-string.md](../../includes/iot-authentication-service-connection-string.md)]
150+
147151
1. Create an empty folder called **trigger-reboot-on-device**. In the **trigger-reboot-on-device** folder, create a package.json file using the following command at your command prompt. Accept all the defaults:
148152
149153
```cmd/sh

articles/iot-hub/device-management-python.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ In this section, you:
5353

5454
* Use the reported properties to enable device twin queries to identify devices and when they last rebooted.
5555

56+
[!INCLUDE [iot-authentication-device-connection-string.md](../../includes/iot-authentication-device-connection-string.md)]
57+
5658
In Azure Cloud Shell you used previously, or any other environment with Python, create the device code.
5759

5860
1. At your command prompt, run the following command to install the **azure-iot-device** package:
@@ -160,6 +162,8 @@ In Azure Cloud Shell you used previously, or any other environment with Python,
160162
161163
In this section, you create a Python console app that initiates a remote reboot on a device using a direct method. The app uses device twin queries to discover the last reboot time for that device.
162164
165+
[!INCLUDE [iot-authentication-service-connection-string.md](../../includes/iot-authentication-service-connection-string.md)]
166+
163167
In Azure Cloud Shell or any other environment with Python, create the console code.
164168
165169
1. At your command prompt, run the following command to install the **azure-iot-hub** package:

articles/iot-hub/iot-hub-bulk-identity-mgmt.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ Identity registry operations use the job system when the operation:
3737

3838
Instead of a single API call waiting or blocking on the result of the operation, the operation asynchronously creates a job for that IoT hub. The operation then immediately returns a **JobProperties** object.
3939

40+
[!INCLUDE [iot-authentication-service-connection-string.md](../../includes/iot-authentication-service-connection-string.md)]
41+
4042
The following C# code snippet shows how to create an export job:
4143

4244
```csharp

articles/iot-hub/iot-hub-live-data-visualization-in-web-apps.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ The service connection string should look similar to the following example:
6464

6565
Note down the service connection string, you need it later in this tutorial.
6666

67+
[!INCLUDE [iot-authentication-service-connection-string.md](../../includes/iot-authentication-service-connection-string.md)]
68+
6769
## Download the web app from GitHub
6870

6971
Download or clone the web app sample from GitHub: [web-apps-node-iot-hub-data-visualization](https://github.com/Azure-Samples/web-apps-node-iot-hub-data-visualization.git).

articles/iot-hub/iot-hub-managed-identity.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,6 @@ Azure IoT Hub SDKs also support this functionality in the service client's regis
376376
```csharp
377377
// Create an export job
378378
379-
using RegistryManager srcRegistryManager = RegistryManager.CreateFromConnectionString(hubConnectionString);
380-
381379
JobProperties jobProperties = JobProperties.CreateForExportJob(
382380
outputBlobContainerUri: blobContainerUri,
383381
excludeKeysInExport: false,
@@ -391,8 +389,6 @@ Azure IoT Hub SDKs also support this functionality in the service client's regis
391389
```csharp
392390
// Create an import job
393391
394-
using RegistryManager destRegistryManager = RegistryManager.CreateFromConnectionString(hubConnectionString);
395-
396392
JobProperties jobProperties = JobProperties.CreateForImportJob(
397393
inputBlobContainerUri: blobContainerUri,
398394
outputBlobContainerUri: blobContainerUri,
@@ -407,7 +403,7 @@ Azure IoT Hub SDKs also support this functionality in the service client's regis
407403

408404
```python
409405
# see note below
410-
iothub_job_manager = IoTHubJobManager("<IoT Hub connection string>")
406+
iothub_job_manager = IoTHubJobManager("<IoT Hub connection information>")
411407

412408
# Create an import job
413409
result = iothub_job_manager.create_import_export_job(JobProperties(

articles/iot-hub/module-twins-dotnet.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ openssl req -new -key d1m1.key.pem -out d1m1.csr -subj "/CN=device01\/module01"
4949

5050
[!INCLUDE [iot-hub-include-find-registryrw-connection-string](../../includes/iot-hub-include-find-registryrw-connection-string.md)]
5151

52+
[!INCLUDE [iot-authentication-service-connection-string.md](../../includes/iot-authentication-service-connection-string.md)]
53+
5254
[!INCLUDE [iot-hub-get-started-create-module-identity-csharp](../../includes/iot-hub-get-started-create-module-identity-csharp.md)]
5355

5456
## Update the module twin using .NET device SDK
@@ -57,6 +59,8 @@ Now let's communicate to the cloud from your simulated device. Once a module ide
5759

5860
To retrieve your module connection string, navigate to your [IoT hub](https://portal.azure.com/#view/HubsExtension/BrowseResource/resourceType/Microsoft.Devices%2FIotHubs) then select **Devices**. Find and select **myFirstDevice** to open it and then select **myFirstModule** to open it. In **Module Identity Details**, copy the **Connection string (primary key)** and save it for the console app.
5961

62+
[!INCLUDE [iot-authentication-device-connection-string.md](../../includes/iot-authentication-device-connection-string.md)]
63+
6064
1. In Visual Studio, add a new project to your solution by selecting **File** > **New** > **Project**. In **Create a new project**, select **Console App (.NET Framework)**, and select **Next**.
6165

6266
1. In **Configure your new project**, name the project *UpdateModuleTwinReportedProperties*, then select **Next**.

articles/iot-hub/module-twins-node.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,14 @@ openssl req -new -key d1m1.key.pem -out d1m1.csr -subj "/CN=device01\/module01"
4949

5050
[!INCLUDE [iot-hub-include-find-registryrw-connection-string](../../includes/iot-hub-include-find-registryrw-connection-string.md)]
5151

52+
[!INCLUDE [iot-authentication-service-connection-string.md](../../includes/iot-authentication-service-connection-string.md)]
53+
5254
## Create a device identity and a module identity in IoT Hub
5355

5456
In this section, you create a Node.js app that creates a device identity and a module identity in the identity registry in your IoT hub. A device or module can't connect to IoT 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). When you run this console app, it generates a unique ID and key for both device and module. The ID and key are case-sensitive. Your device and module use these values to identify itself when it sends device-to-cloud messages to IoT Hub.
5557

58+
[!INCLUDE [iot-authentication-device-connection-string.md](../../includes/iot-authentication-device-connection-string.md)]
59+
5660
1. Create a directory to hold your code.
5761

5862
2. Inside of that directory, first run **npm init -y** to create an empty package.json with defaults. This is the project file for your code.
@@ -134,7 +138,7 @@ In this section, you create a Node.js app on your simulated device that updates
134138

135139
![Azure portal module detail](./media/module-twins-node/module-detail.png)
136140

137-
2. Similar to what you did in the previous section, create a directory for your device code and use NPM to initialize it and install the device SDK (**npm install -S azure-iot-device-amqp\@modules-preview**).
141+
2. Similar to what you did in the previous section, create a directory for your device code and use npm to initialize it and install the device SDK (**npm install -S azure-iot-device-amqp\@modules-preview**).
138142

139143
> [!NOTE]
140144
> The npm install command may feel slow. Be patient; it's pulling down lots of code from the package repository.

articles/iot-hub/module-twins-portal-dotnet.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ The module identity and module twin features are only available in the IoT Hub p
8888

8989
### Create UpdateModuleTwinReportedProperties console app
9090

91+
[!INCLUDE [iot-authentication-device-connection-string.md](../../includes/iot-authentication-device-connection-string.md)]
92+
9193
To create your app, follow these steps:
9294

9395
1. Add the following `using` statements at the top of the **Program.cs** file:

0 commit comments

Comments
 (0)