Skip to content

Commit fddce32

Browse files
authored
Merge pull request #80543 from robinsh/robinsh-0625-reza
Robinsh 0625 reza
2 parents a7cf5b7 + 28dd83c commit fddce32

15 files changed

+62
-58
lines changed

articles/iot-hub/iot-hub-amqp-support.md

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
---
22
title: Understand Azure IoT Hub AMQP support | Microsoft Docs
33
description: Developer guide - support for devices connecting to IoT Hub device-facing and service-facing endpoints using the AMQP Protocol. Includes information about built-in AMQP support in the Azure IoT device SDKs.
4-
author: rezasherafat
5-
manager:
4+
author: robinsh
65
ms.service: iot-hub
76
services: iot-hub
87
ms.topic: conceptual
98
ms.date: 04/30/2019
10-
ms.author: rezas
9+
ms.author: robinsh
1110
---
1211

1312
# Communicate with your IoT hub by using the AMQP Protocol
@@ -18,11 +17,12 @@ Azure IoT Hub supports [OASIS Advanced Message Queuing Protocol
1817
## Service client
1918

2019
### Connect and authenticate to an IoT hub (service client)
20+
2121
To connect to an IoT hub by using AMQP, a client can use the [claims-based security (CBS)](https://www.oasis-open.org/committees/download.php/60412/amqp-cbs-v1.0-wd03.doc) or [Simple Authentication and Security Layer (SASL) authentication](https://en.wikipedia.org/wiki/Simple_Authentication_and_Security_Layer).
2222

2323
The following information is required for the service client:
2424

25-
| Information | Value |
25+
| Information | Value |
2626
|-------------|--------------|
2727
| IoT hub hostname | `<iot-hub-name>.azure-devices.net` |
2828
| Key name | `service` |
@@ -36,14 +36,15 @@ import uamqp
3636
import urllib
3737
import time
3838

39-
# Use generate_sas_token implementation available here: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security#security-token-structure
39+
# Use generate_sas_token implementation available here:
40+
# https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security#security-token-structure
4041
from helper import generate_sas_token
4142

4243
iot_hub_name = '<iot-hub-name>'
4344
hostname = '{iot_hub_name}.azure-devices.net'.format(iot_hub_name=iot_hub_name)
4445
policy_name = 'service'
4546
access_key = '<primary-or-secondary-key>'
46-
operation = '<operation-link-name>' # e.g., '/messages/devicebound'
47+
operation = '<operation-link-name>' # example: '/messages/devicebound'
4748

4849
username = '{policy_name}@sas.root.{iot_hub_name}'.format(iot_hub_name=iot_hub_name, policy_name=policy_name)
4950
sas_token = generate_sas_token(hostname, access_key, policy_name)
@@ -55,6 +56,7 @@ receive_client = uamqp.ReceiveClient(uri, debug=True)
5556
```
5657

5758
### Invoke cloud-to-device messages (service client)
59+
5860
To learn about the cloud-to-device message exchange between the service and the IoT hub and between the device and the IoT hub, see [Send cloud-to-device messages from your IoT hub](iot-hub-devguide-messages-c2d.md). The service client uses two links to send messages and receive feedback for previously sent messages from devices, as described in the following table:
5961

6062
| Created by | Link type | Link path | Description |
@@ -117,8 +119,11 @@ for msg in batch:
117119
```
118120

119121
As shown in the preceding code, a cloud-to-device feedback message has a content type of *application/vnd.microsoft.iothub.feedback.json*. You can use the properties in the message's JSON body to infer the delivery status of the original message:
122+
120123
* Key `statusCode` in the feedback body has one of the following values: *Success*, *Expired*, *DeliveryCountExceeded*, *Rejected*, or *Purged*.
124+
121125
* Key `deviceId` in the feedback body has the ID of the target device.
126+
122127
* Key `originalMessageId` in the feedback body has the ID of the original cloud-to-device message that was sent by the service. You can use this delivery status to correlate feedback to cloud-to-device messages.
123128

124129
### Receive telemetry messages (service client)
@@ -128,8 +133,11 @@ By default, your IoT hub stores ingested device telemetry messages in a built-in
128133
For this purpose, the service client first needs to connect to the IoT hub endpoint and receive a redirection address to the built-in event hubs. The service client then uses the provided address to connect to the built-in event hub.
129134

130135
In each step, the client needs to present the following pieces of information:
136+
131137
* Valid service credentials (service shared access signature token).
138+
132139
* A well-formatted path to the consumer group partition that it intends to retrieve messages from. For a given consumer group and partition ID, the path has the following format: `/messages/events/ConsumerGroups/<consumer_group>/Partitions/<partition_id>` (the default consumer group is `$Default`).
140+
133141
* An optional filtering predicate to designate a starting point in the partition. This predicate can be in the form of a sequence number, offset, or enqueued timestamp.
134142

135143
The following code snippet uses the [uAMQP library in Python](https://github.com/Azure/azure-uamqp-python) to demonstrate the preceding steps:
@@ -189,29 +197,29 @@ for msg in batch:
189197

190198
For a given device ID, the IoT hub uses a hash of the device ID to determine which partition to store its messages in. The preceding code snippet demonstrates how events are received from a single such partition. However, note that a typical application often needs to retrieve events that are stored in all event hub partitions.
191199

192-
193200
## Device client
194201

195202
### Connect and authenticate to an IoT hub (device client)
203+
196204
To connect to an IoT hub by using AMQP, a device can use [claims based security (CBS)](https://www.oasis-open.org/committees/download.php/60412/amqp-cbs-v1.0-wd03.doc) or [Simple Authentication and Security Layer (SASL)](https://en.wikipedia.org/wiki/Simple_Authentication_and_Security_Layer) authentication.
197205

198206
The following information is required for the device client:
199207

200-
| Information | Value |
208+
| Information | Value |
201209
|-------------|--------------|
202210
| IoT hub hostname | `<iot-hub-name>.azure-devices.net` |
203211
| Access key | A primary or secondary key that's associated with the device |
204212
| Shared access signature | A short-lived shared access signature in the following format: `SharedAccessSignature sig={signature-string}&se={expiry}&skn={policyName}&sr={URL-encoded-resourceURI}`. To get the code for generating this signature, see [Control access to IoT Hub](./iot-hub-devguide-security.md#security-token-structure).
205213

206-
207214
The following code snippet uses the [uAMQP library in Python](https://github.com/Azure/azure-uamqp-python) to connect to an IoT hub via a sender link.
208215

209216
```python
210217
import uamqp
211218
import urllib
212219
import uuid
213220

214-
# Use generate_sas_token implementation available here: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security#security-token-structure
221+
# Use generate_sas_token implementation available here:
222+
# https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security#security-token-structure
215223
from helper import generate_sas_token
216224

217225
iot_hub_name = '<iot-hub-name>'
@@ -236,14 +244,14 @@ The following link paths are supported as device operations:
236244
| Devices | Sender link | `/devices/<deviceID>messages/events` | Device-to-cloud messages that are sent from a device are sent over this link. |
237245
| Devices | Sender link | `/messages/serviceBound/feedback` | Cloud-to-device message feedback sent to the service over this link by devices. |
238246

239-
240247
### Receive cloud-to-device commands (device client)
248+
241249
Cloud-to-device commands that are sent to devices arrive on a `/devices/<deviceID>/messages/devicebound` link. Devices can receive these messages in batches, and use the message data payload, message properties, annotations, or application properties in the message as needed.
242250

243251
The following code snippet uses the [uAMQP library in Python](https://github.com/Azure/azure-uamqp-python)) to receive cloud-to-device messages by a device.
244252

245253
```python
246-
# ...
254+
# ...
247255
# Create a receive client for the cloud-to-device receive link on the device
248256
operation = '/devices/{device_id}/messages/devicebound'.format(device_id=device_id)
249257
uri = 'amqps://{}:{}@{}{}'.format(urllib.quote_plus(username), urllib.quote_plus(sas_token), hostname, operation)
@@ -279,13 +287,13 @@ while True:
279287
```
280288

281289
### Send telemetry messages (device client)
290+
282291
You can also send telemetry messages from a device by using AMQP. The device can optionally provide a dictionary of application properties, or various message properties, such as message ID.
283292

284293
The following code snippet uses the [uAMQP library in Python](https://github.com/Azure/azure-uamqp-python) to send device-to-cloud messages from a device.
285294

286-
287295
```python
288-
# ...
296+
# ...
289297
# Create a send client for the device-to-cloud send link on the device
290298
operation = '/devices/{device_id}/messages/events'.format(device_id=device_id)
291299
uri = 'amqps://{}:{}@{}{}'.format(urllib.quote_plus(username), urllib.quote_plus(sas_token), hostname, operation)
@@ -324,7 +332,9 @@ for result in results:
324332
```
325333

326334
## Additional notes
335+
327336
* The AMQP connections might be disrupted because of a network glitch or the expiration of the authentication token (generated in the code). The service client must handle these circumstances and reestablish the connection and links, if needed. If an authentication token expires, the client can avoid a connection drop by proactively renewing the token prior to its expiration.
337+
328338
* Your client must occasionally be able to handle link redirections correctly. To understand such an operation, see your AMQP client documentation.
329339

330340
## Next steps
@@ -335,4 +345,4 @@ To learn more about IoT Hub messaging, see:
335345

336346
* [Cloud-to-device messages](./iot-hub-devguide-messages-c2d.md)
337347
* [Support for additional protocols](iot-hub-protocol-gateway.md)
338-
* [Support for the Message Queuing Telemetry Transport (MQTT) Protocol](./iot-hub-mqtt-support.md)
348+
* [Support for the Message Queuing Telemetry Transport (MQTT) Protocol](./iot-hub-mqtt-support.md)

articles/iot-hub/iot-hub-devguide-query-language.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
title: Understand the Azure IoT Hub query language | Microsoft Docs
33
description: Developer guide - description of the SQL-like IoT Hub query language used to retrieve information about device/module twins and jobs from your IoT hub.
4-
author: rezasherafat
4+
author: robinsh
55
ms.service: iot-hub
66
services: iot-hub
77
ms.topic: conceptual
88
ms.date: 10/29/2018
9-
ms.author: rezas
9+
ms.author: robinsh
1010
---
1111

1212
# IoT Hub query language for device and module twins, jobs, and message routing
@@ -323,8 +323,8 @@ SELECT <select_list>
323323

324324
The **FROM <from_specification>** clause can assume only three values: **FROM devices** to query device twins, **FROM devices.modules** to query module twins, or **FROM devices.jobs** to query job per-device details.
325325

326-
327326
## WHERE clause
327+
328328
The **WHERE <filter_condition>** clause is optional. It specifies one or more conditions that the JSON documents in the FROM collection must satisfy to be included as part of the result. Any JSON document must evaluate the specified conditions to "true" to be included in the result.
329329

330330
The allowed conditions are described in section [Expressions and conditions](iot-hub-devguide-query-language.md#expressions-and-conditions).
@@ -361,6 +361,7 @@ SELECT [TOP <max number>] <projection list>
361361
Currently, selection clauses different than **SELECT*** are only supported in aggregate queries on device twins.
362362

363363
## GROUP BY clause
364+
364365
The **GROUP BY <group_specification>** clause is an optional step that executes after the filter specified in the WHERE clause, and before the projection specified in the SELECT. It groups documents based on the value of an attribute. These groups are used to generate aggregated values as specified in the SELECT clause.
365366

366367
An example of a query using GROUP BY is:
@@ -388,9 +389,9 @@ Currently, the GROUP BY clause is only supported when querying device twins.
388389
> [!IMPORTANT]
389390
> The term `group` is currently treated as a special keyword in queries. In case, you use `group` as your property name, consider surrounding it with double brackets to avoid errors, e.g., `SELECT * FROM devices WHERE tags.[[group]].name = 'some_value'`.
390391
>
391-
>
392392
393393
## Expressions and conditions
394+
394395
At a high level, an *expression*:
395396

396397
* Evaluates to an instance of a JSON type (such as Boolean, number, string, array, or object).
@@ -438,6 +439,7 @@ To understand what each symbol in the expressions syntax stands for, refer to th
438439
| string_literal |String literals are Unicode strings represented by a sequence of zero or more Unicode characters or escape sequences. String literals are enclosed in single quotes or double quotes. Allowed escapes: `\'`, `\"`, `\\`, `\uXXXX` for Unicode characters defined by 4 hexadecimal digits. |
439440

440441
### Operators
442+
441443
The following operators are supported:
442444

443445
| Family | Operators |
@@ -447,6 +449,7 @@ The following operators are supported:
447449
| Comparison |=, !=, <, >, <=, >=, <> |
448450

449451
### Functions
452+
450453
When querying twins and jobs the only supported function is:
451454

452455
| Function | Description |
@@ -496,4 +499,4 @@ In routes conditions, the following string functions are supported:
496499

497500
## Next steps
498501

499-
Learn how to execute queries in your apps using [Azure IoT SDKs](iot-hub-devguide-sdks.md).
502+
Learn how to execute queries in your apps using [Azure IoT SDKs](iot-hub-devguide-sdks.md).

articles/iot-hub/iot-hub-device-streams-overview.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
---
22
title: Azure IoT Hub device streams (preview) | Microsoft Docs
3-
description: Overview of IoT Hub device streams.
4-
author: rezasherafat
5-
manager: briz
3+
description: Overview of IoT Hub device streams
4+
author: robinsh
65
services: iot-hub
76
ms.service: iot-hub
87
ms.topic: conceptual
98
ms.date: 01/15/2019
10-
ms.author: rezas
9+
ms.author: robinsh
1110
---
1211

1312
# IoT Hub Device Streams (preview)

articles/iot-hub/iot-hub-ip-filtering.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
title: Azure IoT Hub IP connection filters | Microsoft Docs
33
description: How to use IP filtering to block connections from specific IP addresses for to your Azure IoT hub. You can block connections from individual or ranges of IP addresses.
4-
author: rezasherafat
4+
author: robinsh
55
ms.service: iot-hub
66
services: iot-hub
77
ms.topic: conceptual
88
ms.date: 05/23/2017
9-
ms.author: rezas
9+
ms.author: robinsh
1010
---
1111

1212
# Use IP filters

articles/iot-hub/iot-hub-mqtt-support.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
---
22
title: Understand Azure IoT Hub MQTT support | Microsoft Docs
33
description: Developer guide - support for devices connecting to an IoT Hub device-facing endpoint using the MQTT protocol. Includes information about built-in MQTT support in the Azure IoT device SDKs.
4-
author: rezasherafat
5-
manager:
4+
author: robinsh
65
ms.service: iot-hub
76
services: iot-hub
87
ms.topic: conceptual
98
ms.date: 10/12/2018
10-
ms.author: rezas
9+
ms.author: robinsh
1110
---
1211
# Communicate with your IoT hub using the MQTT protocol
1312

articles/iot-hub/quickstart-device-streams-echo-c.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
---
22
title: Communicate to a device app in C via Azure IoT Hub device streams (preview) | Microsoft Docs
33
description: In this quickstart, you run a C device-side application that communicates with an IoT device via a device stream.
4-
author: rezasherafat
5-
manager: briz
4+
author: robinsh
65
ms.service: iot-hub
76
services: iot-hub
87
ms.devlang: c
98
ms.topic: quickstart
109
ms.custom: mvc
1110
ms.date: 03/14/2019
12-
ms.author: rezas
11+
ms.author: robinsh
1312
---
1413

1514
# Quickstart: Communicate to a device application in C via IoT Hub device streams (preview)

articles/iot-hub/quickstart-device-streams-echo-csharp.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
---
22
title: Communicate to a device app in C# via Azure IoT Hub device streams (preview) | Microsoft Docs
33
description: In this quickstart, you run two sample C# applications that communicate via a device stream established through IoT Hub.
4-
author: rezasherafat
5-
manager: briz
4+
author: robinsh
65
ms.service: iot-hub
76
services: iot-hub
87
ms.devlang: csharp
98
ms.topic: quickstart
109
ms.custom: mvc
1110
ms.date: 03/14/2019
12-
ms.author: rezas
11+
ms.author: robinsh
1312
---
1413

1514
# Quickstart: Communicate to a device application in C# via IoT Hub device streams (preview)

articles/iot-hub/quickstart-device-streams-echo-nodejs.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
---
22
title: Communicate to a device app in Node.js via IoT Hub device streams (preview) | Microsoft Docs
33
description: In this quickstart, you will run a Node.js service-side applications that communicates with an IoT device via a device stream.
4-
author: rezasherafat
5-
manager: briz
4+
author: robinsh
65
ms.service: iot-hub
76
services: iot-hub
87
ms.devlang: nodejs
98
ms.topic: quickstart
109
ms.custom: mvc
1110
ms.date: 03/14/2019
12-
ms.author: rezas
11+
ms.author: robinsh
1312
---
1413

1514
# Quickstart: Communicate to a device application in Node.js via IoT Hub device streams (preview)

articles/iot-hub/quickstart-device-streams-proxy-c.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
---
22
title: Azure IoT Hub device streams C quickstart for SSH and RDP (preview) | Microsoft Docs
33
description: In this quickstart, you run a sample C application that acts as a proxy to enable SSH and RDP scenarios over IoT Hub device streams.
4-
author: rezasherafat
5-
manager: briz
4+
author: robinsh
65
ms.service: iot-hub
76
services: iot-hub
87
ms.devlang: c
98
ms.topic: quickstart
109
ms.custom: mvc
1110
ms.date: 03/14/2019
12-
ms.author: rezas
11+
ms.author: robinsh
1312
---
1413

1514
# Quickstart: Enable SSH and RDP over an IoT Hub device stream by using a C proxy application (preview)

articles/iot-hub/quickstart-device-streams-proxy-csharp.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
---
22
title: Azure IoT Hub device streams C# quickstart for SSH and RDP (preview) | Microsoft Docs
33
description: In this quickstart, you run two sample C# applications that enable SSH and RDP scenarios over an IoT Hub device stream.
4-
author: rezasherafat
5-
manager: briz
4+
author: robinsh
65
ms.service: iot-hub
76
services: iot-hub
87
ms.devlang: csharp
98
ms.topic: quickstart
109
ms.custom: mvc
1110
ms.date: 03/14/2019
12-
ms.author: rezas
11+
ms.author: robinsh
1312
---
1413

1514
# Quickstart: Enable SSH and RDP over an IoT Hub device stream by using a C# proxy application (preview)

0 commit comments

Comments
 (0)