How can i get the connection string for IoT hub in Azure Digital Twin - azure-digital-twins

Resource only return following object and not connection string which I need to call Direct methods on device.
[{"id":"585302d5-f4c9-4248-bb50-482657c028ba","spaceId":"b27f5aa2-ba06-4ffa-9750-b4a3655a6096","type":"IotHub","isExternallyCreated":false,"status":"Running","lastUpdatedUtc":"2019-02-21T10:22:00.0456407","properties":{"iothubUrl":"ih-46de7654-b8c5-4ddc-9e50-b455d36d4146-1.azure-devices.net"},"instanceNum":1}]

The connectionString can only be retrieved from the devices endpoint.
GET https://{{instanceName}}.{{regionName}}.azuresmartspaces.net/management/api/v1.0/devices?includes=ConnectionString
In the early preview version of Digital Twins Command and Control is not available.

Currently Azure Digital Twins doesn't support command & control to devices. You can get the device connection string but you cannot get the IoT Hub's connection string to issue commands (or device twins).
Moving forward we have heard a lot of feedback from customers that they want/need to send commands and in the next set of updates to Digital Twins we are looking at how to enable this. Stay tuned as we will have updates later in 2019. Thanks for the interest & question.

Related

Access device connection string in IoT Edge module via Device Provisioning Services

We're moving our Azure IoT Edge devices from manual provisioning to DPS with symmetric key. One of the modules deployed to our devices needs to manage the Device Twin - we have been using this for state properties that persist across updates to modules. To connect to the device twin, I've been creating a DeviceClient from connection string which is loaded as an environment variable on a per device basis. This is using the C SDK.
Now I want to request the device credentials during provisioning so that the symmetric key is the only secret pre installed on the device.
A number of posts suggest that this isn't possible with best practices, most succinctly:
Access IoT Edge Device Twin from Edge Module when using X.509 Authentication
Is this still the case? If so, what is the intended use for the device twin on IoT Edge, if user modules aren't supposed to access it in a production setting?
A number of posts suggest that this isn't possible with best practices, most succinctly: Access IoT Edge Device Twin from Edge Module when using X.509 Authentication. Is this still the case?
This is still the case. Modules accessing device twin information is not supported or recommended. There are other ways to achieve what is desired - like one you described in your comment.
what is the intended use for the device twin on IoT Edge, if user modules aren't supposed to access it in a production setting?
The use case for device twins in IoT Edge is ADM deployments.
You create a deployment manifest and then define which devices it applies to based on tags in the device twin.
Ref: Understand IoT Edge automatic deployments for single devices or at scale

How can I connect a real device only accepting MQTT / TCP connection to azure IoT hub?

Context:
I have a real device that only uses MQTT and only accepts a TCP connection (The only things I can modify in the real device are the cloud address, cloud ID (username), cloud password, machine cloud ID and cloud port).
Question:
How can I connect this device to the azure IoT hub?
Can I use azure IoT edge runtime w/ transparent gateway?
In case if you want to try connectivity with IoT hub and if there is no feasibility for usage of device SDK in your device, you can try the option of using MQTT protocol directly (as a device), using which the device can still connect to the public device endpoints using the MQTT protocol on port 8883.
However, for using the MQTT protocol directly, the device must connect over TLS/SSL. Since your device has constraints in using TLS/SSL or installing certificate, the best option is usage of gateway.
In a typical IoT system, gateways are used to overcome the limitations of device capabilities. You may need to decide the suitable deployment type based on these three patterns of using IoT Edge device as a gateway as per your device capabilities and requirement in hand.
There is a scenario where you don't have to use the device SDK and connect your MQTT device directly to the IoT Hub. It is documented here. Azure IoT Hub is not a full-featured MQTT broker though, so results may vary. As per your suggestion, yes you can use a transparent gateway for this if you don't want your device to connect directly to the IoT Hub. But it's not a prerequisite.
In the case that your device needs more MQTT features than IoT Hub (or Edge for that matter) can offer, you can also consider creating an Edge module with an MQTT broker inside.

How to send simulated data from a device to an Azure IoT Edge device

I have worked with sending data using a c# code to send simulated data from a device to an IoT Hub, but I am not able to find documentation on how to do the same i.e send data to an on premise IoT Edge device.
Any guidancewould be greatly appreciated.
Once you set up IoT Edge as a transparent gateway(https://learn.microsoft.com/en-us/azure/iot-edge/how-to-create-transparent-gateway); and update your connection string used in your C# code to append "GatewayHostName="; your c# code should work and messages will route to Edge Hub and then IoT Hub.

Google IOT device on webhooks & post

Is there any way to create your own google IOT device based on webhooks and POST-request? Without using firebase, IFTT, node.js
Samples that Google are very poor, they don`t show all steps of creating your own app, they just showing how to deploy "their sample"
I tried to make action with dialogflow & webhook, it was pretty simple. Just processed JSON in POST request to Azure function.
But when I try to create IOT device, its ask me for fulfilment url and it does not even tries to reach that address. I read about action.device.sync, action.device.execute, it just does not communicate with the specified address, giving simulator some voice command doesn`t affect at all. Are there any ways to create IOT device to work with POST-requests & web-hooks?
The answer is it depends.
There are many different ways to do server-device communication: web sockets, local servers, hub/local control, polling, MQTT, and likely many others. All of these solutions have trade-offs, and work in particular circumstances. Depending on exactly what IoT device you want to build, its requirements and technical specs, and what cloud providers you are using, you may identify what works best.
If you run the sample, you'll see it is sending JSON requests to a server and expect JSON responses back. This is must like Dialogflow & a webhook. In this case, the smart home platform communicates solely with the server.
Your server can then communicate with the device in any way that you want. I'm not too familiar with Azure offerings. It might have an MQTT service as well, or some other sort of push notification service you might be able to use.
If you're seeing simulator issues, you may need to make sure your authentication is set up correctly, and you'll need to first complete account linking on your phone before you can use the simulator.

communicate with remote safenet hsm using TCP connection

I am new to the HSM, i have to connect to remote safenet HSM using TCP connection ? how should i communicate ? whats the TPK,TMK and how it works ? please share some links or documents.
First off, whenever you see a reference to an "_MK" on an HSM, it's referring to the the master key. Each acronym may be vendor specific. These master keys are used to protect other keys that you or your applications may generate on the device.
To interact with a remote SafeNet HSM, the HSM must first be configured for network use. When you first power up a networked HSM, you'll need to connect to it over a serial connection first, and you can then configure an IP for the NIC. Once that's done, you can use the supplied CLI tools that come with the SafeNet Luna Client Driver for Windows/Linux to connect and even do some test operations (demo tool allows testing simple things like RSA key gen).
Is your HSM device a network or PCI based HSM?
As I have been working with network based HSM, you need to install the driver for this particular network HSM and configure it by setting up the IP address (It is a wizard so you will not miss it).
After doing so, the windows registry will be updated and on your application you do not have to change anything, it is as calling normal ProtectToolkit API.
It is mentioned in the manual (PDF) when you purchased the device. Check the installation folder.

Resources