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
> Azure CLI installation by default includes the Azure IoT CLI extension, however for some preview features, please upgrade the IoT CLI extension following the instructions [here](https://github.com/Azure/azure-iot-cli-extension).
23
25
24
26
**IoT Hub and an endpoint service**
25
27
26
28
You need an IoT hub and at least one other service to serve as an endpoint to an IoT hub route.
27
29
28
30
* An IoT hub in your [Azure subscription](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). If you don't have a hub yet, you can follow the steps in [Create an IoT hub using the Azure CLI](iot-hub-create-using-cli.md).
29
31
30
-
You can choose which Azure service (Event Hubs, Service Bus queue or topic, or Azure Storage) endpoint that you'd like to connect with your IoT Hub route. You only need one service to assign the endpoint to a route.
32
+
You can choose which Azure service (Event Hubs, Service Bus queue or topic, Azure Storage, or Azure Cosmos DB) endpoint that you'd like to connect with your IoT Hub route.
31
33
32
34
# [Event Hubs](#tab/eventhubs)
33
35
@@ -153,6 +155,24 @@ You can choose an Azure Storage resource (account and container).
153
155
154
156
For more information, see [Create a storage account](/azure/storage/common/storage-account-create?tabs=azure-cli).
155
157
158
+
# [Cosmos DB](#tab/cosmosdb)
159
+
160
+
You can choose a Cosmos DB endpoint.
161
+
162
+
### Create an Azure Storage resource with container
163
+
164
+
1. Create a new Cosmos DB account for SQL API
165
+
```azurecli
166
+
az group create --name my-resource-group --location "eastus"
167
+
az cosmosdb create --name my-cosmosdb-account --resource-group my-resource-group
For more information, see [Create an Azure Cosmos DB for NoSQL](/cosmos-db/scripts/cli/nosql/create).
175
+
156
176
---
157
177
158
178
## Create an endpoint
@@ -245,6 +265,32 @@ References used in the following commands:
245
265
246
266
For more parameter options, see [az iot hub routing-endpoint](/cli/azure/iot/hub/routing-endpoint).
247
267
268
+
# [Cosmos DB](#tab/cosmosdb)
269
+
270
+
References used in the following commands:
271
+
*[az cosmosdb](/cli/azure/cosmosdb)
272
+
*[az iot hub](/cli/azure/iot/hub)
273
+
274
+
### Create a Cosmos DB endpoint
275
+
276
+
1. Find the Cosmos DB connection string and copy for later use.
277
+
278
+
```azurecli
279
+
az cosmosdb keys list --name my-cosmosdb-account --resource-group my-resource-group --type connection-strings
280
+
```
281
+
282
+
1. Create your custom endpoint. Use the connection string in this command that you copied in the last step. The `endpoint-type` must be `eventhub`, otherwise all other values should be your own.
> If you are using managed identities instead of connection string, you have to use the following command to authenticate your identity to the CosmosDB account.
289
+
To see all routing endpoint options, see [az iot hub routing-endpoint](/cli/azure/iot/hub/routing-endpoint).
290
+
291
+
```azurecli
292
+
az cosmosdb sql role assignment create -a my-cosmosdb-account -g my-resource-group --scope '/' -n 'Cosmos DB Built-in Data Contributor' -p "IoT Hub System Assigned or User Assigned Identity"
In this how-to article you learned how to create a route and endpoint for your Event Hubs, Service Bus queue or topic, and Azure Storage.
413
459
414
-
To further your exploration into message routing, see [Tutorial: Send device data to Azure Storage using IoT Hub message routing](/azure/iot-hub/tutorial-routing?tabs=cli). In this tutorial, you'll create a storage route and test it with a device in your IoT hub.
460
+
To further your exploration into message routing, see [Tutorial: Send device data to Azure Storage using IoT Hub message routing](/azure/iot-hub/tutorial-routing?tabs=cli). In this tutorial, you'll create a storage route and test it with a device in your IoT hub.
0 commit comments