-
Notifications
You must be signed in to change notification settings - Fork 7
Connecting to IoT Central
git clone --depth 1 https://github.com/Azure/azure-sphere-samples.git
You must set up Azure IoT Central to work with Azure Sphere, if you have not already done so.
-
Go to Azure IoT Central in your browser.
-
From the Azure IoT Central Application, click Administration > Device connection, then on the Auto approve new devices option, select Enabled.
-
Find the app_manifest.json file in your sample directory and open it. In the following steps, you'll gather the following information and add it to this file:
- The Scope ID for your Azure IoT Central application.
- The allowed connections for your Azure Sphere device.
- The Tenant ID for your Azure Sphere device.
-
At the command prompt, run the ShowIoTCentralConfig program from the Windows or Linux folder in the sample repository. For example, on Windows, the path is ..\Samples\AzureIoT\Tools\win-x64\ShowIoTCentralConfig.exe. When running this tool on a Linux machine you may have to explicitly set permissions. For example, from a terminal, run
chmod +x ShowIoTCentralConfig
to set permissions on the tool.Note: If you are unable to run the ShowIoTCentralConfig program at the command prompt, delete the AppData\Local\Temp.net\ShowIoTCentralConfig folder, then run the program again.
Now follow the prompts that the tool provides, and copy the information from the output into the app_manifest.json file. The tool will require the following input:
-
The IoT Central App URL can be found in your browser address bar; for example,
https://myiotcentralapp.azureiotcentral.com/
. -
The API token can be generated from your IoT Central application. In the Azure IoT Central application, click Administration > API Tokens > Generate Token, then provide a name for the token; for example, "AzureSphereSample." Select Administrator as the role. Click Generate, and then copy the token to the clipboard. The token starts with SharedAccessSignature.
-
The ID Scope is in the Azure IoT Central application. Click Administration > Device Connection, then copy the ID Scope.
-
-
At the command prompt, run the following command to get the Tenant ID:
azsphere tenant show-selected
Paste the GUID for your tenant into the DeviceAuthentication field of the app_manifest.json file.
-
Check that your updated app_manifest.json file has lines that looks like this:
"CmdArgs": [ "--ScopeID", "<scope_id>" ]
and:
"AllowedConnections": [ "global.azure-devices-provisioning.net", "iotc-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.azure-devices.net", "iotc-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.azure-devices.net", "iotc-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.azure-devices.net", "iotc-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.azure-devices.net", "iotc-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.azure-devices.net","iotc-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.azure-devices.net", "iotc-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.azure-devices.net", "iotc-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.azure-devices.net","iotc-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.azure-devices.net", "iotc-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.azure-devices.net" ],
and:
"DeviceAuthentication": "<GUID>"
-
Save the updated application manifest.
AzureSphereDevX Examples Wiki
- Home
- Build Tools
- Adding the DevX library
- Azure IoT Hub Messaging
- Azure IoT Hub Device Twins
- Azure IoT Hub Direct Methods
- Avnet IoT Connect messaging
- Handling multithreaded async events
- Working with GPIO
- Working with UARTS
- Working with PWM
- Working with Event Timers
- Intercore Messaging
- Application termination
- Deferring updates
- Utility functions
- Tools and scripts
- Hardware Definitions