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
Copy file name to clipboardExpand all lines: articles/iot-hub/iot-hub-create-use-iot-toolkit.md
+8-49Lines changed: 8 additions & 49 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,11 +23,13 @@ This article shows you how to use the [Azure IoT Hub extension for Visual Studio
23
23
24
24
-[Azure IoT Hub extension](https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.azure-iot-toolkit) installed for Visual Studio Code
25
25
26
+
- An Azure subscription: [create a free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
27
+
26
28
- An Azure resource group: [create a resource group](../azure-resource-manager/management/manage-resource-groups-portal.md#create-resource-groups) in the Azure portal
27
29
28
-
## Create an IoT hub without an IoT Project
30
+
## Create an IoT hub
29
31
30
-
The following steps show how to create an IoT Hub without an IoT Project in Visual Studio Code (VS Code).
32
+
The following steps show how to create an IoT hub in Visual Studio Code (VS Code).
31
33
32
34
1. In VS Code, open the **Explorer** view.
33
35
@@ -39,7 +41,7 @@ The following steps show how to create an IoT Hub without an IoT Project in Visu
39
41
40
42
:::image type="content" source="./media/iot-hub-create-use-iot-toolkit/create-iot-hub.png" alt-text="A screenshot that shows the location of the Create IoT Hub list item in Visual Studio Code." lightbox="./media/iot-hub-create-use-iot-toolkit/create-iot-hub.png":::
41
43
42
-
4.A pop-up shows in the bottom-right corner to let you sign in to Azure for the first time, if you're not signed in already.
44
+
4.If you're not signed into Azure, a pop-up notification is shown in the bottomright corner to let you sign in to Azure. Select **Sign In** and follow the instructions to sign into Azure.
43
45
44
46
5. From the command palette at the top of VS Code, select your Azure subscription.
45
47
@@ -49,55 +51,12 @@ The following steps show how to create an IoT Hub without an IoT Project in Visu
49
51
50
52
8. Select a pricing tier.
51
53
52
-
9. Enter a globally unique name for your IoT hub, then press **Enter**.
53
-
54
-
10. Wait a few minutes until the IoT hub is created. You'll see a confirmation in the output console.
55
-
56
-
## Create an IoT hub and device in an existing IoT project
57
-
58
-
The following steps show how to create an IoT hub and register a device to the hub within an existing IoT project in Visual Studio (VS) Code.
59
-
60
-
This method allows you to provision in Visual Studio Code without leaving your development environment.
61
-
62
-
1. In the new opened project window, press `F1` to open the command palette, type and select **Azure IoT Device Workbench: Provision Azure Services...**.
63
-
64
-
:::image type="content" source="media/iot-hub-create-use-iot-toolkit/provision.png" alt-text="A screenshot that shows how to open the command palette in VS Code." lightbox="media/iot-hub-create-use-iot-toolkit/provision.png":::
65
-
66
-
> [!NOTE]
67
-
> If you have not signed into Azure, follow the pop-up notification for signing in.
68
-
69
-
1. Select the subscription you want to use.
70
-
71
-
:::image type="content" source="media/iot-hub-create-use-iot-toolkit/select-subscription.png" alt-text="A screenshot that shows how to choose your Azure subscription in Visual Studio Code." lightbox="media/iot-hub-create-use-iot-toolkit/select-subscription.png":::
72
-
73
-
1. Select an existing resource group or create a new [resource group](../azure-resource-manager/management/overview.md#terminology).
74
-
75
-
:::image type="content" source="media/iot-hub-create-use-iot-toolkit/select-resource-group.png" alt-text="A screenshot that shows how to choose a resource group or create a new one in Visual Studio Code." lightbox="media/iot-hub-create-use-iot-toolkit/select-resource-group.png":::
76
-
77
-
1. In the resource group you specified, follow the prompts to select an existing IoT hub or create a new Azure IoT hub.
78
-
79
-
:::image type="content" source="media/iot-hub-create-use-iot-toolkit/iot-hub-provision.png" alt-text="A screenshot that shows the first prompt in choosing an existing IoT hub in Visual Studio Code." lightbox="media/iot-hub-create-use-iot-toolkit/iot-hub-provision.png":::
80
-
81
-
:::image type="content" source="media/iot-hub-create-use-iot-toolkit/select-iot-hub.png" alt-text="A screenshot that shows the second prompt in choosing an existing IoT hub in Visual Studio Code." lightbox="media/iot-hub-create-use-iot-toolkit/select-iot-hub.png":::
82
-
83
-
:::image type="content" source="media/iot-hub-create-use-iot-toolkit/iot-hub-selected.png" alt-text="A screenshot that shows the third prompt in choosing an existing IoT hub in Visual Studio Code." lightbox="media/iot-hub-create-use-iot-toolkit/iot-hub-selected.png":::
84
-
85
-
1. In the output window, you see the Azure IoT hub provisioned.
86
-
87
-
:::image type="content" source="media/iot-hub-create-use-iot-toolkit/iot-hub-provisioned.png" alt-text="A screenshot that shows the output window in Visual Studio Code." lightbox="media/iot-hub-create-use-iot-toolkit/iot-hub-provisioned.png":::
88
-
89
-
1. Select or create a new IoT device in the Azure IoT hub you provisioned.
90
-
91
-
:::image type="content" source="media/iot-hub-create-use-iot-toolkit/iot-device-provision.png" alt-text="A screenshot that shows the fourth prompt in choosing an existing IoT hub in Visual Studio Code." lightbox="media/iot-hub-create-use-iot-toolkit/iot-device-provision.png":::
92
-
93
-
:::image type="content" source="media/iot-hub-create-use-iot-toolkit/select-iot-device.png" alt-text="A screenshot that shows an example of an existing IoT hub in Visual Studio Code." lightbox="media/iot-hub-create-use-iot-toolkit/select-iot-device.png":::
94
-
95
-
1. Now you have an Azure IoT hub provisioned and a device created in it. The device connection string is saved in VS Code.
54
+
9. Enter a globally unique name for your IoT hub, and then select the Enter key.
96
55
97
-
:::image type="content" source="media/iot-hub-create-use-iot-toolkit/provision-done.png" alt-text="A screenshot that shows IoT hub details in the output window in Visual Studio Code." lightbox="media/iot-hub-create-use-iot-toolkit/provision-done.png":::
56
+
10. Wait a few minutes until the IoT hub is created. You'll see a confirmation in the **Output** panel.
98
57
99
58
> [!TIP]
100
-
> To delete a device from your IoT hub, use the `Azure IoT Hub: Delete Device` option from the Command Palette. There is no option to delete your IoT hub in Visual Studio Code, however you can [delete your hub in the Azure portal](iot-hub-create-through-portal.md#delete-an-iot-hub).
59
+
> There is no option to delete your IoT hub in Visual Studio Code, however you can [delete your hub in the Azure portal](iot-hub-create-through-portal.md#delete-an-iot-hub).
In this article, you learn how to use the [Azure IoT Hub extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.azure-iot-toolkit) with various management options on your development machine. The IoT Hub extension is a useful Visual Studio Code extension that makes IoT Hub management and IoT application development easier. It comes with management options that you can use to perform various tasks.
16
+
In this article, you learn how to use the [Azure IoT Hub extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.azure-iot-toolkit) with various management options on your development machine. The IoT Hub extension is a useful Visual Studio (VS) Code extension that makes IoT Hub management and IoT application development easier. It comes with management options that you can use to perform various tasks.
@@ -39,50 +39,66 @@ Device twins are JSON documents that store device state information (metadata, c
39
39
40
40
## Sign in to access your IoT hub
41
41
42
-
1. In **Explorer** view of VS Code, expand **Azure IoT Hub Devices** section in the bottom left corner.
42
+
Follow these steps to sign into Azure and access your IoT hub from your Azure subscription:
43
43
44
-
2. Click **Select IoT Hub** in context menu.
44
+
1. In the **Explorer** view of VS Code, expand the **Azure IoT Hub**section in the side bar.
45
45
46
-
3. A pop-up will show in the bottom right corner to let you sign in to Azure for the first time.
46
+
1. Select the ellipsis (…) button of the **Azure IoT Hub** section to display the action menu, and then select **Select IoT Hub** from the action menu.
47
47
48
-
4. After you sign in, your Azure Subscription list will be shown, then select Azure Subscription and IoT Hub.
48
+
1. If you're not signed into Azure, a pop-up notification is shown in the bottom right corner to let you sign in to Azure. Select **Sign In**and follow the instructions to sign into Azure.
49
49
50
-
5. The device list will be shown in **Azure IoT Hub Devices** tab in a few seconds.
50
+
1. From the command palette at the top of VS Code, select your Azure subscription from the **Select Subscription** dropdown list.
51
+
52
+
1. Select your IoT hub from the **Select IoT Hub** dropdown list.
53
+
54
+
1. The devices for your IoT hub are retrieved from IoT Hub and shown under the **Devices** node in the **Azure IoT Hub** section of the side bar.
51
55
52
56
> [!NOTE]
53
-
> You can also complete the set up by choosing**Set IoT Hub Connection String**. Enter the **iothubowner** policy connection string for the IoT hub that your IoT device connects to in the pop-up window.
57
+
> You can also use a connection string to access your IoT hub, by selecting**Set IoT Hub Connection String** from the action menu and entering the **iothubowner** policy connection string for your IoT hub in the **IoT Hub Connection String** input box.
54
58
55
59
## Direct methods
56
60
57
-
1. Right-click your device and select **Invoke Direct Method**.
61
+
To invoke a direct method from your IoT device, follow these steps:
62
+
63
+
1. In the side bar, expand the **Devices** node under the **Azure IoT Hub** section.
64
+
65
+
1. Right-click your IoT device and select **Invoke Device Direct Method**.
58
66
59
-
2. Enter the method name and payload in input box.
67
+
1. Enter the method name in the input box, and then select the Enter key.
60
68
61
-
3. Results will be shown in **OUTPUT** > **Azure IoT Hub** view.
69
+
1. Enter the payload in the input box, and then select the Enter key.
70
+
71
+
1. The results are shown in the **Output** panel.
62
72
63
73
## Read device twin
64
74
65
-
1. Right-click your device and select **Edit Device Twin**.
75
+
To display the JSON document for the device twin of your IoT device, follow these steps:
76
+
77
+
1. In the side bar, expand the **Devices** node under the **Azure IoT Hub** section.
78
+
79
+
1. Right-click your IoT device and select **Edit Device Twin**.
66
80
67
-
2. An **azure-iot-device-twin.json** file will be opened with the content of device twin.
81
+
1. The JSON document for the device twin, named **azure-iot-device-twin.json**, is shown in the editor.
68
82
69
83
## Update device twin
70
84
71
-
1. Make some edits of **tags** or **properties.desired** field.
85
+
After [reading the device twin](#read-device-twin), follow these steps to update the device twin for your IoT device:
72
86
73
-
2. Right-click on the **azure-iot-device-twin.json** file.
87
+
1. Make changes to arrays or values in the JSON document for the devicetwin. For example, add tags in the **tags** array, or change the values of desired properties in the **properties.desired** array.
74
88
75
-
3. Select **Update Device Twin** to update the device twin.
89
+
1. Right-click the content area of the **azure-iot-device-twin.json** file and select **Update Device Twin**.
76
90
77
91
## Send cloud-to-device messages
78
92
79
93
To send a message from your IoT hub to your device, follow these steps:
80
94
81
-
1. Right-click your device and select **Send C2D Message to Device**.
95
+
1. In the side bar, expand the **Devices** node under the **Azure IoT Hub** section.
96
+
97
+
1. Right-click your IoT device and select **Send C2D Message to Device**.
82
98
83
-
2. Enter the message in input box.
99
+
1. Enter the message in the input box, and then select the Enter key.
84
100
85
-
3. Results will be shown in **OUTPUT** > **Azure IoT Hub**view.
Copy file name to clipboardExpand all lines: articles/iot-hub/iot-hub-mqtt-support.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -121,14 +121,14 @@ If a device can't use the device SDKs, it can still connect to the public device
121
121
You can also use the cross-platform [Azure IoT Hub extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.azure-iot-toolkit) or the CLI extension command [az iot hub generate-sas-token](/cli/azure/iot/hub#az-iot-hub-generate-sas-token) to quickly generate a SAS token. You can then copy and paste the SAS token into your own code for testing purposes.
122
122
123
123
### Using the Azure IoT Hub extension for Visual Studio Code
124
-
125
-
1. Expand the **AZURE IOT HUB DEVICES** tab in the bottom left corner of Visual Studio Code.
126
124
127
-
2. Right-click your device and select **Generate SAS Token for Device**.
125
+
1. In the side bar, expand the **Devices** node under the **Azure IoT Hub** section.
126
+
127
+
1. Right-click your IoT device and select **Generate SAS Token for Device** from the context menu.
128
128
129
-
3. Set **expiration time**and press 'Enter'.
129
+
1. Enter the expiration time, in hours, for the SAS token in the input box, and then select the Enter key.
130
130
131
-
4. The SAS token is created and copied to clipboard.
131
+
1. The SAS token is created and copied to clipboard.
132
132
133
133
The SAS token that's generated has the following structure:
Copy file name to clipboardExpand all lines: articles/iot-hub/iot-hub-vscode-iot-toolkit-cloud-device-messaging.md
+20-12Lines changed: 20 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,38 +32,46 @@ The [Azure IoT Hub extension for Visual Studio Code](https://marketplace.visuals
32
32
33
33
## Sign in to access your IoT hub
34
34
35
-
1. In **Explorer** view of VS Code, expand **Azure IoT Hub Devices** section in the bottom left corner.
35
+
Follow these steps to sign into Azure and access your IoT hub from your Azure subscription:
36
36
37
-
2. Click **Select IoT Hub** in context menu.
37
+
1. In the **Explorer** view of VS Code, expand the **Azure IoT Hub**section in the side bar.
38
38
39
-
3. A pop-up will show in the bottom right corner to let you sign in to Azure for the first time.
39
+
1. Select the ellipsis (…) button of the **Azure IoT Hub** section to display the action menu, and then select **Select IoT Hub** from the action menu.
40
40
41
-
4. After you sign in, your Azure Subscription list will be shown, then select Azure Subscription and IoT Hub.
41
+
1. If you're not signed into Azure, a pop-up notification is shown in the bottom right corner to let you sign in to Azure. Select **Sign In**and follow the instructions to sign into Azure.
42
42
43
-
5. The device list will be shown in **Azure IoT Hub Devices** tab in a few seconds.
43
+
1. Select your Azure subscription from the **Select Subscription** dropdown list.
44
+
45
+
1. Select your IoT hub from the **Select IoT Hub** dropdown list.
46
+
47
+
1. The devices for your IoT hub are retrieved from IoT Hub and shown under the **Devices** node in the **Azure IoT Hub** section of the side bar.
44
48
45
49
> [!NOTE]
46
-
> You can also complete the set up by choosing**Set IoT Hub Connection String**. Enter the **iothubowner** policy connection string for the IoT hub that your IoT device connects to in the pop-up window.
50
+
> You can also use a connection string to access your IoT hub, by selecting**Set IoT Hub Connection String** from the action menu and entering the **iothubowner** policy connection string for your IoT hub in the **IoT Hub Connection String** input box.
47
51
48
52
## Monitor device-to-cloud messages
49
53
50
54
To monitor messages that are sent from your device to your IoT hub, follow these steps:
51
55
52
-
1. Right-click your device and select **Start Monitoring Built-in Event Endpoint**.
56
+
1. In the side bar, expand the **Devices** node under the **Azure IoT Hub** section.
57
+
58
+
1. Right-click your IoT device and select **Start Monitoring Built-in Event Endpoint**.
53
59
54
-
2. The monitored messages will be shown in **OUTPUT** > **Azure IoT Hub**view.
60
+
1. The monitored messages are shown in the **Output**panel.
55
61
56
-
3. To stop monitoring, right-click the **OUTPUT**view and select **Stop Monitoring Built-in Event Endpoint**.
62
+
1. To stop monitoring messages, right-click the **Output**panel and select **Stop Monitoring Built-in Event Endpoint**.
57
63
58
64
## Send cloud-to-device messages
59
65
60
66
To send a message from your IoT hub to your device, follow these steps:
67
+
68
+
1. In the side bar, expand the **Devices** node under the **Azure IoT Hub** section.
61
69
62
-
1. Right-click your device and select **Send C2D Message to Device**.
70
+
1. Right-click your IoT device and select **Send C2D Message to Device** from the context menu.
63
71
64
-
2. Enter the message in input box.
72
+
1. Enter the message in the input box, and then select the Enter key.
65
73
66
-
3. Results will be shown in **OUTPUT** > **Azure IoT Hub**view.
0 commit comments