Skip to content

Commit 28dbcab

Browse files
Merge pull request #218061 from Usha-Rathnavel/docs-editor/iot-concepts-and-iot-hub-1668174944
CosmosDB-endpoint
2 parents bbd080b + 053cfff commit 28dbcab

File tree

5 files changed

+37
-11
lines changed

5 files changed

+37
-11
lines changed

articles/iot-hub/iot-concepts-and-iot-hub.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ iot-hub-devguide-endpoints.md#list-of-built-in-iot-hub-endpoints)
110110

111111
Data can also be routed to different services for further processing. As the IoT solution scales out, the number of devices, volume of events, variety of events, and different services also varies. A flexible, scalable, consistent, and reliable method to route events is necessary to serve this pattern. Once a message route has been created, data stops flowing to the built-in-endpoint unless a fallback route has been configured. For a tutorial showing multiple uses of message routing, see the [Routing Tutorial](tutorial-routing.md).
112112

113+
IoT Hub supports setting up custom endpoints for various existing Azure services like Storage containers, Event Hubs, Service Bus queues, Service Bus topics, and Cosmos DB. Once the endpoint has been set up, you can route your IoT data to any of these endpoints to perform downstream data operations.
114+
113115
IoT Hub also integrates with Event Grid, which enables you to fan out data to multiple subscribers. Event Grid is a fully managed event service that enables you to easily manage events across many different Azure services and applications. Made for performance and scale, it simplifies building event-driven applications and serverless architectures. The differences between message routing and using Event Grid are explained in the [Message Routing and Event Grid Comparison](iot-hub-event-grid-routing-comparison.md)
114116

115117
## Next steps
@@ -124,3 +126,4 @@ To learn more about the ways you can build and deploy IoT solutions with Azure I
124126

125127
- [What is Azure IoT device and application development](../iot-develop/about-iot-develop.md)
126128
- [Fundamentals: Azure IoT technologies and solutions](../iot-fundamentals/iot-services-and-technologies.md)
129+

articles/iot-hub/iot-hub-devguide-endpoints.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,12 @@ You can link existing Azure services in your Azure subscriptions to your IoT hub
6969

7070
IoT Hub currently supports the following Azure services as additional endpoints:
7171

72-
* Azure Storage containers
72+
* Storage containers
7373
* Event Hubs
7474
* Service Bus Queues
7575
* Service Bus Topics
76-
76+
* Cosmos DB (preview)
77+
7778
For the limits on the number of endpoints you can add, see [Quotas and throttling](iot-hub-devguide-quotas-throttling.md).
7879

7980
## Endpoint Health
@@ -93,4 +94,4 @@ Other reference topics in this IoT Hub developer guide include:
9394
* [IoT Hub query language for device twins, jobs, and message routing](iot-hub-devguide-query-language.md)
9495
* [Quotas and throttling](iot-hub-devguide-quotas-throttling.md)
9596
* [IoT Hub MQTT support](iot-hub-mqtt-support.md)
96-
* [Understand your IoT hub IP address](iot-hub-understand-ip-address.md)
97+
* [Understand your IoT hub IP address](iot-hub-understand-ip-address.md)

articles/iot-hub/iot-hub-devguide-messages-d2c.md

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ If your custom endpoint has firewall configurations, consider using the [Microso
3636
IoT Hub currently supports the following endpoints:
3737

3838
- Built-in endpoint
39-
- Azure Storage
39+
- Storage containers
4040
- Service Bus Queues and Service Bus Topics
41-
- Event Hubs
42-
41+
- Event Hubs
42+
- Cosmos DB (preview)
43+
4344
## Built-in endpoint as a routing endpoint
4445

4546
You can use standard [Event Hubs integration and SDKs](iot-hub-devguide-messages-read-builtin.md) to receive device-to-cloud messages from the built-in endpoint (**messages/events**). Once a Route is created, data stops flowing to the built-in-endpoint unless a Route is created to that endpoint. Even if no routes are created, a fallback route must be enabled to route messages to the built-in endpoint. The fallback is enabled by default if you create your hub using the portal or the CLI.
@@ -94,6 +95,26 @@ Service Bus queues and topics used as IoT Hub endpoints must not have **Sessions
9495

9596
Apart from the built-in-Event Hubs compatible endpoint, you can also route data to custom endpoints of type Event Hubs.
9697

98+
## Azure Cosmos DB as a routing endpoint (preview)
99+
You can send data directly to Azure Cosmos DB from IoT Hub. Cosmos DB is a fully managed hyperscale multi-model database service. It provides very low latency and high availability, making it a great choice for scenarios like connected solutions and manufacturing which require extensive downstream data analysis.
100+
101+
IoT Hub supports writing to Cosmos DB in JSON (if specified in the message content-type) or as Base64 encoded binary. In order to set up a route to Cosmos DB, you will have to do the following:
102+
103+
From your provisioned IoT Hub, go to the Hub settings and click on message routing. Go to the Custom endpoints tab, click on Add and select Cosmos DB. The following image shows the endpoint addition:
104+
105+
![Screenshot that shows how to add a Cosmos DB endpoint.](media/iot-hub-devguide-messages-d2c/add-cosmos-db-endpoint.png)
106+
107+
Enter your endpoint name. You should be able to choose from a list of Cosmos DB accounts available for selection, along with the Database and collection.
108+
109+
As Cosmos DB is a hyperscale datastore, all data/documents written to it must contain a field that represents a logical partition. The partition key property name is defined at the Container level and cannot be changed once it has been set. Each logical partition has a maximum size of 20GB. To effectively support high-scale scenarios, you can enable [Synthetic Partition Keys](/azure/cosmos-db/nosql/synthetic-partition-keys) for the Cosmos DB endpoint and configure them based on your estimated data volume. For example, in manufacturing scenarios, your logical partition might be expected to approach its max limit of 20 GB within a month. In that case, you can define a Synthetic Partition Key which is a combination of the device id and the month. This key will be automatically added to the partition key field for each new Cosmos DB record, ensuring logical partitions are created each month for each device.
110+
111+
 You can choose any of the supported authentication types for accessing the database, based on your system setup.
112+
113+
> [!Caution]
114+
> If you are using the System managed identity for authenticating to CosmosDB, you will need to have a “Cosmos DB Built in Data Contributor” Role assigned via CLI. The role setup is not supported from the portal today. For more details on the various roles, see [Configure role-based access for Azure Cosmos DB](/azure/cosmos-db/how-to-setup-rbac). To understand assigning roles via CLI, see [Manage Azure Cosmos DB SQL role resources.](/cli/azure/cosmosdb/sql/role)
115+
116+
Once you have selected all the details, click on create and complete the setup of the custom endpoint.
117+
97118
## Reading data that has been routed
98119

99120
You can configure a route by following this [tutorial](tutorial-routing.md).
@@ -110,7 +131,6 @@ Use the following tutorials to learn how to read messages from an endpoint.
110131

111132
* Read from [Service Bus Topics](../service-bus-messaging/service-bus-dotnet-how-to-use-topics-subscriptions.md)
112133

113-
114134
## Fallback route
115135

116136
The fallback route sends all the messages that don't satisfy query conditions on any of the existing routes to the built-in-Event Hubs (**messages/events**), that is compatible with [Event Hubs](../event-hubs/index.yml). If message routing is turned on, you can enable the fallback route capability. Once a route is created, data stops flowing to the built-in-endpoint, unless a route is created to that endpoint. If there are no routes to the built-in-endpoint and a fallback route is enabled, only messages that don't match any query conditions on routes will be sent to the built-in-endpoint. Also, if all existing routes are deleted, fallback route must be enabled to receive all data at the built-in-endpoint.
@@ -121,7 +141,6 @@ You can enable/disable the fallback route in the Azure portal->Message Routing b
121141

122142
In addition to device telemetry, message routing also enables sending device twin change events, device lifecycle events, digital twin change events, and device connection state events. For example, if a route is created with data source set to **device twin change events**, IoT Hub sends messages to the endpoint that contain the change in the device twin. Similarly, if a route is created with data source set to **device lifecycle events**, IoT Hub sends a message indicating whether the device or module was deleted or created. For more information about device lifecycle events, see [Device and module lifecycle notifications](./iot-hub-devguide-identity-registry.md#device-and-module-lifecycle-notifications). When using [Azure IoT Plug and Play](../iot-develop/overview-iot-plug-and-play.md), a developer can create routes with data source set to **digital twin change events** and IoT Hub sends messages whenever a digital twin property is set or changed, a digital twin is replaced, or when a change event happens for the underlying device twin. Finally, if a route is created with data source set to **device connection state events**, IoT Hub sends a message indicating whether the device was connected or disconnected.
123143

124-
125144
[IoT Hub also integrates with Azure Event Grid](iot-hub-event-grid.md) to publish device events to support real-time integrations and automation of workflows based on these events. See key [differences between message routing and Event Grid](iot-hub-event-grid-routing-comparison.md) to learn which works best for your scenario.
126145

127146
## Limitations for device connection state events
@@ -155,3 +174,5 @@ Use the [troubleshooting guide for routing](troubleshoot-message-routing.md) for
155174
* [How to send device-to-cloud messages](../iot-develop/quickstart-send-telemetry-iot-hub.md?pivots=programming-language-nodejs)
156175

157176
* For information about the SDKs you can use to send device-to-cloud messages, see [Azure IoT SDKs](iot-hub-devguide-sdks.md).
177+
178+

articles/iot-hub/iot-hub-devguide-messages-read-custom.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,19 @@ For more information about creating custom endpoints in IoT Hub, see [IoT Hub en
4040

4141
For more information about reading from custom endpoints, see:
4242

43-
* Reading from [Azure Storage containers](../storage/blobs/storage-blobs-introduction.md).
44-
43+
* Reading from [Storage containers](../storage/blobs/storage-blobs-introduction.md).
4544
* Reading from [Event Hubs](../event-hubs/event-hubs-dotnet-standard-getstarted-send.md).
4645

4746
* Reading from [Service Bus queues](../service-bus-messaging/service-bus-dotnet-get-started-with-queues.md).
4847

4948
* Reading from [Service Bus topics](../service-bus-messaging/service-bus-dotnet-how-to-use-topics-subscriptions.md).
50-
49+
* Reading from [Cosmos DB](/azure/cosmos-db/nosql/query/getting-started)
5150
## Next steps
5251

5352
* For more information about IoT Hub endpoints, see [IoT Hub endpoints](iot-hub-devguide-endpoints.md).
5453

5554
* For more information about the query language you use to define routing queries, see [Message Routing query syntax](iot-hub-devguide-routing-query-syntax.md).
5655

5756
* The [Process IoT Hub device-to-cloud messages using routes](tutorial-routing.md) tutorial shows you how to use routing queries and custom endpoints.
57+
58+
139 KB
Loading

0 commit comments

Comments
 (0)