IoT Hub
7 TopicsGet Device to Cloud messages in IoT Hub using Rest API
Hello, I'm currently trying to get the messages that I sent to my azure iot hub using rest api (postman), but without success, I always got 204 no content. thats how i'm sending the message: Type: POST Url: https://{{iothub-north}}/devices/{{new-device}}/messages/events?api-version={{api-version}} Authorization: SharedAccessSignature sr={my sas-key}&sig={my-sig}se={my-se}. Answer: 204 No Content. thats how i'm trying to get the messages: Type: GET Url: https://{{iothub-north}}/devices/{{new-device}}/messages/deviceBound?api-version={{api-version}} Authorization: SharedAccessSignature sr={my sas-key}&sig={my-sig}se={my-se}. Answer: 204 No Content. I was searching for some documentation and found this: https://learn.microsoft.com/en-us/rest/api/iothub/device/receive-device-bound-notification however, for what I understood, it only works for cloud to device messages, so can someone help me how can I get the messages that I sent from my device to my azure iot hub? Obs: I've created one service bus to link in my azure iot hub just to be sure that I'm receiving the messages that I sent, and it's working, so probably the issue is something about the way I'm trying to GET these messages.839Views0likes0CommentsFails to publish with user-defined topic to IoT hub
Hi all, I am new to azure ecosystem. I followed some examples and documents and able to connect to the Azure IoT Hub and able to send data. The data is being sent on device/<deviceID>/messages/events topic(telemetry message) topic. From same application, I am not able to publish the message on custom topic(user-defined). Can you please help me if I am missing any additional configuration/settings for Azure IoT?805Views0likes0CommentsVisual Studio 2019 extension for building REST APIs exposing IoT Hub features
Hi all, If you need to write REST APIs (.Net Core) to expose or complete IoT Hub APIs or create a facade, this extension will help you to save a few minutes. It creates a ready to use solution in a few seconds and allows you to focus on important code (business logic, etc). The created API includes other features like: - API versioning - Automatic OpenAPI generation (versioned according to API versions) - separated layers - minimalistic solution with required dependencies only The only thing you need to do is to set the IoT Hub connection in the configuration file (appsettings.json). More details here.1.9KViews1like3CommentsQuerying IoT Devices on IoT Hub
Hi All, today I deployed 3 IoT Hubs (SKU S3) in region "West Europe" and I got the same issue for all IoT Hubs, when I select IoT Devices, I get an error message that querying devices failed: There was an error querying devices: InternalServerError:{ "Message": "ErrorCode:ServerError;InternalServerError", "ExceptionMessage": "ErrorCode: ServerError\r\nMessage: \r\nTimestamp: 02/22/2021 13:17:58\r\nTracking ID: b916cd1004554b5586f14eaed10e7073-G:0-TimeStamp:02/22/2021 13:17:58\r\nPublic Message: \r\nPublic Info: null\r\nException: Microsoft.Azure.Devices.Common.Core.Exceptions.IotHubException ---> System.ArgumentNullException: Value cannot be null.\r\nParameter name: documentCollectionOrDatabaseUri\r\n at Microsoft.Azure.Documents.Client.DocumentClient.CreateDocumentQuery[T](Uri documentCollectionOrDatabaseUri, String sqlExpression, FeedOptions feedOptions)\r\n at Microsoft.Azure.Devices.DocumentDb.PassThroughDocumentClientProxy.CreateDocumentQuery[T](Uri documentCollectionUri, String sqlExpression, FeedOptions feedOptions) in C:\\source\\common\\Microsoft.Azure.Devices.Common\\DocumentDb\\PassThroughDocumentClientProxy.cs:line 65\r\n at System.Lazy`1.CreateValue()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Lazy`1.get_Value()\r\n at Microsoft.Azure.Devices.DocumentDb.FeatureFilterCheckDocumentQueryProxy`1.<GetDocumentQueryProxyWithFeatureCheckAsync>d__7.MoveNext() in C:\\source\\common\\Microsoft.Azure.Devices.Common\\DocumentDb\\FeatureFilterCheckDocumentQueryProxy.cs:line 60\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Azure.Devices.DocumentDb.FeatureFilterCheckDocumentQueryProxy`1.<ExecuteNextAsync>d__6`1.MoveNext() in C:\\source\\common\\Microsoft.Azure.Devices.Common\\DocumentDb\\FeatureFilterCheckDocumentQueryProxy.cs:line 0\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Azure.Devices.DeviceManagement.DataAccess.TransactionalStore.DocumentDb.DmDocumentDbClient.<QueryDevicesInternalAsync>d__51.MoveNext() in C:\\source\\dm\\Microsoft.Azure.Devices.DeviceManagement\\DataAccess\\TransactionalStore\\DocumentDb\\DmDocumentDbClient.cs:line 2513\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Azure.Devices.DeviceManagement.DataAccess.TransactionalStore.DocumentDb.DmDocumentDbClient.<QueryDevicesAsync>d__50.MoveNext() in C:\\source\\dm\\Microsoft.Azure.Devices.DeviceManagement\\DataAccess\\TransactionalStore\\DocumentDb\\DmDocumentDbClient.cs:line 2491\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Azure.Devices.DeviceManagement.Registry.ManagedDeviceRegistry.<QueryDevicesAsync>d__19.MoveNext() in C:\\source\\dm\\Microsoft.Azure.Devices.DeviceManagement\\Registry\\ManagedDeviceRegistry.cs:line 133\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Azure.Devices.Gateway.Management.Providers.DeviceApiProvider.<QueryDevicesInternalAsync>d__102.MoveNext() in C:\\source\\gateway\\mgmt\\Providers\\DeviceApiProvider.cs:line 2328\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Azure.Devices.Gateway.Management.Providers.DeviceApiProvider.<QueryDevicesAsync>d__49.MoveNext() in C:\\source\\gateway\\mgmt\\Providers\\DeviceApiProvider.cs:line 1061\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Azure.Devices.Gateway.Management.DeviceApiActionResult`1.<ExecuteAsync>d__7.MoveNext() in C:\\source\\gateway\\mgmt\\DeviceApiActionResult.cs:line 94\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Azure.Devices.Gateway.Management.ActionFilters.GlobalActionFilter.<ExecuteActionFilterAsync>d__0.MoveNext() in C:\\source\\gateway\\mgmt\\ActionFilters\\GlobalActionFilter.cs:line 42\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()\r\n --- End of inner exception stack trace ---", "ExceptionType": "Microsoft.Azure.Devices.Common.Core.Exceptions.IotHubException", "StackTrace": null, "InnerException": { "Message": "An error has occurred.", "ExceptionMessage": "Value cannot be null.\r\nParameter name: documentCollectionOrDatabaseUri", "ExceptionType": "System.ArgumentNullException", "StackTrace": " at Microsoft.Azure.Documents.Client.DocumentClient.CreateDocumentQuery[T](Uri documentCollectionOrDatabaseUri, String sqlExpression, FeedOptions feedOptions)\r\n at Microsoft.Azure.Devices.DocumentDb.PassThroughDocumentClientProxy.CreateDocumentQuery[T](Uri documentCollectionUri, String sqlExpression, FeedOptions feedOptions) in C:\\source\\common\\Microsoft.Azure.Devices.Common\\DocumentDb\\PassThroughDocumentClientProxy.cs:line 65\r\n at System.Lazy`1.CreateValue()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Lazy`1.get_Value()\r\n at Microsoft.Azure.Devices.DocumentDb.FeatureFilterCheckDocumentQueryProxy`1.<GetDocumentQueryProxyWithFeatureCheckAsync>d__7.MoveNext() in C:\\source\\common\\Microsoft.Azure.Devices.Common\\DocumentDb\\FeatureFilterCheckDocumentQueryProxy.cs:line 60\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Azure.Devices.DocumentDb.FeatureFilterCheckDocumentQueryProxy`1.<ExecuteNextAsync>d__6`1.MoveNext() in C:\\source\\common\\Microsoft.Azure.Devices.Common\\DocumentDb\\FeatureFilterCheckDocumentQueryProxy.cs:line 0\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Azure.Devices.DeviceManagement.DataAccess.TransactionalStore.DocumentDb.DmDocumentDbClient.<QueryDevicesInternalAsync>d__51.MoveNext() in C:\\source\\dm\\Microsoft.Azure.Devices.DeviceManagement\\DataAccess\\TransactionalStore\\DocumentDb\\DmDocumentDbClient.cs:line 2513\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Azure.Devices.DeviceManagement.DataAccess.TransactionalStore.DocumentDb.DmDocumentDbClient.<QueryDevicesAsync>d__50.MoveNext() in C:\\source\\dm\\Microsoft.Azure.Devices.DeviceManagement\\DataAccess\\TransactionalStore\\DocumentDb\\DmDocumentDbClient.cs:line 2491\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Azure.Devices.DeviceManagement.Registry.ManagedDeviceRegistry.<QueryDevicesAsync>d__19.MoveNext() in C:\\source\\dm\\Microsoft.Azure.Devices.DeviceManagement\\Registry\\ManagedDeviceRegistry.cs:line 133\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Azure.Devices.Gateway.Management.Providers.DeviceApiProvider.<QueryDevicesInternalAsync>d__102.MoveNext() in C:\\source\\gateway\\mgmt\\Providers\\DeviceApiProvider.cs:line 2328\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Azure.Devices.Gateway.Management.Providers.DeviceApiProvider.<QueryDevicesAsync>d__49.MoveNext() in C:\\source\\gateway\\mgmt\\Providers\\DeviceApiProvider.cs:line 1061\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Azure.Devices.Gateway.Management.DeviceApiActionResult`1.<ExecuteAsync>d__7.MoveNext() in C:\\source\\gateway\\mgmt\\DeviceApiActionResult.cs:line 94\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Azure.Devices.Gateway.Management.ActionFilters.GlobalActionFilter.<ExecuteActionFilterAsync>d__0.MoveNext() in C:\\source\\gateway\\mgmt\\ActionFilters\\GlobalActionFilter.cs:line 42\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()" } }. I try to create a new IoT Device (that worked based on notification) but still the query is broken, therefore I can't read the DeviceConnectionString. Any ideas, what I can do to solve this issue? Thanks & with best regards, Alex1.7KViews0likes4CommentsVision DevKit sending to IoT Hub, now how do I get Images?
I have successfully have setup the Vision DevKit, in which is connected and currently sending data (assuming images of camera feed) to IoT Hub, yay! Here is what I'm looking to do next: Label images from feed in Azure (which is necessary to create a custom ML Vision Model) I'm new to IoT Hub, so i need to extract this data feed into a way I can access. I setup Message Routing to Storage for now. But when I look at Storage/Container files they are .avro. I'm looking for ideas on how to access this feed and organize these images without have to go through using memory card on the Camera. I'd like to manage this whole process in the Azure Cloud. I'm thinking a jupyter notebook in python or any other Azure projects that can help? But first, i would need how to take those .avro (assuming messages) and convert them to something meaningful. Or perhaps the messages to the Storage isn't the correct path. Thank youSolved2KViews1like1CommentStep-by-step guide to installing OPC Publisher on Azure IoT Edge
Of all the Azure IoT Edge modules, the OPC Publisher is one of the more challenging modules to setup. I've had a number of Industrial IoT partners struggle with connecting an OPC UA server, such as a Historian or SCADA system, to Azure IoT Hub using Azure IoT Edge and our open source OPC Publisher module. So I recently wrote a step-by-step blog post on LinkedIn on how to do this. If you don't have a physical device to act as the IoT Edge gateway, you can use a virtual machine running on-premise or in Azure as an alternative. Hopefully the blog post will help you and save you some headaches when connecting using OPC UA.9.3KViews3likes0CommentsIoT Device Simulation - Device simulator covering a wide range of Azure IoT SDK features
Hi all, In case you will find this useful for your IoT projects, you will find here an #iot device #simulation tool implementing a wide range of #azure IoT SDK capabilities. The approach of the solution is to complete other existing tools. The solution is a .NET Core application. It can be used : as a development tool as a complete IoT flow simulation tool from the device perspective (C2D/D2C, including IoTHub modules) for building simulation platforms (containerized, Docker image). Many configurations are possible through JSON-based settings. All details are here ;). Enjoy 😉971Views2likes0Comments