Skip to main content

Claiming devices using the nRF Cloud Utils

This guide explains how to leverage nRF Cloud Utils to streamline the reading of attestation tokens from your devices and easily claim them to your nRF Cloud account. This is especially important during the manufacturing phase.

Prerequisites

Gather attestation tokens

Use the gather_attestation_tokens.py script to collect the IMEI, UUID, and attestation token from a connected device without requiring an Internet connection.

The collected data, along with the current date and time, is saved to a CSV file. By default, the file is named attestation_tokens.csv. If the file already exists, the script performs the following operations:

  • Append new entries if the UUID is not already present.
  • Replace the row with updated information if the UUID is already in the file.
note

The generated CSV file can later be used with the claim_devices.py script on an Internet-connected computer. Use --help for additional parameter information.

Limitations

  • This script is not supported for nRF9160 devices.
  • This service is only compatible with nRF91x1 devices running modem firmware v2.0.0 or later.

Read and store the attestation token

Use the default configuration to read and store the attestation token into attestation_tokens.csv file with the gather_attestation_tokens command.

Claim devices

Once the attestation tokens have been collected, they need to be claimed in nRF Cloud. The claim_devices.py script claims the devices by sending the contents of a CSV file to the nRF Cloud REST API, along with a specified set of provisioning tags. By default, the script looks for a file named attestation_tokens.csv. If you want to use a different file, you can specify it using the --csv option followed by the file name.

note

Based on your application needs, you have to define your provisioning tag following the instruction in the Managing provisioning commands page. This name will be passed to --provisioning-tags. Otherwise, nRF Cloud Utils will create one named by default nrf-cloud-onboarding where all certificates will be enabled. Use --help for additional parameter information.

Output

The script will display:

  • The total number of devices successfully claimed.
  • The total number of devices attempted.

Examples

  • Claim devices using the default CSV file and a specific provisioning configuration:

    claim_devices --provisioning-tags "nrf-cloud-onboarding" --api-key $API_KEY
  • Claim devices using a custom CSV file:

    claim_devices --csv custom_tokens.csv --provisioning-tags "nrf-cloud-onboarding" --api-key $API_KEY