MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.25k stars 21.42k forks source link

QR code #93872

Closed tervoju closed 2 years ago

tervoju commented 2 years ago

[Enter feedback here]

as such this example is nice but there is actually no explanation how the connection is created i.e what is the QR code content and how that is used for creating the connection.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

asergaz commented 2 years ago

Thank you for your feedback @tervoju . The QR code is the IoT Device Connection String. Like for example:

HostName=YOURIOTHUB.azure-devices.net;DeviceId=device1;SharedAccessKey=D5ACUtiSHKftvGb7WABCDED1ucTpaJmORi03zhoghs=

Will let @dominicbetts evaluate if we can add a note in the documentation referencing that.

romankiss commented 2 years ago

Hi @tervoju, The QR code shows on the Connect/Device connection groups page of the IoT Central App is the Base64 encoded json formatted text with the properties such as deviceId, scopeId, deviceKey, see the following example:

{"deviceId":"device1","scopeId":"0ne0063CB1F","deviceKey":"xxxxxxxxxxxxxsR0BvQ6Jaagyn4="}

Based on the above properties, the device can be provisioned (using the dps service) and connected to the IoT Central App.

Note, that this QR code is suitable only for a device connection already registered in the IoT Central App.

It will be very useful have a QR code contains only scopeId and primaryKey for provisioning and connection a new device, so adding one more QR code on the Permissions/Device connection groups/SAS-IoT Devices page. Please, vote for this new feature here.

You can found more implementation details in my article Azure IoT Central Tester.

Thanks Roman

dominicbetts commented 2 years ago

Thanks @romankiss for providing the details of what's contained in the QR code - I'm adding a brief note to the quickstart to clarify this.

@tervoju - One further point to add - the deviceKey is derived from the default SAS-IoT-Devices enrollment group (Go to Permissions -> Device connection groups to view it). If you want to use your own enrollment group, you need to generate your own derived keys for your devices - see https://docs.microsoft.com/azure/iot-central/core/concepts-device-authentication#sas-enrollment-group

In a production environment, you prefer to have devices "Self-register" - see https://docs.microsoft.com/azure/iot-central/core/concepts-device-authentication#automatically-register-devices.

Typically in a production environment, you should use X.509 certificates instead of SAS keys for your device authentication: https://docs.microsoft.com/azure/iot-central/core/concepts-device-authentication#x509-enrollment-group.

You can find detailed information about device connectivity in:

dominicbetts commented 2 years ago

Hi @tervoju - we didn't hear back from you after the various responses above, so I'll close this issue for now. Feel free to open it again if you have any follow-up questions. Thanks.

dominicbetts commented 2 years ago

please-close