Skip to main content

Using provisioning rules

This guide explains how to use provisioning rules in the nRF Cloud portal and APIs.

note

Before you follow this guide, read it through carefully according to your desired interface. You cannot edit rules after you activate them.

Requirements

Prerequisites

Managing provisioning rules in the nRF Cloud portal

This section explains how to create and manage provisioning rules using the nRF Cloud portal. This applies to manually created provisioning rules. See more on creating a rule and group during device claiming.

Creating provisioning rules

Complete the following steps to create a new provisioning rule:

  1. Log in to the nRF Cloud portal.

  2. In the left sidebar, select Security Services.

    A panel opens to the right.

  3. Select Provisioning Rules.

  4. Click the Create Rule button to create a new rule.

    A pop-up opens.

  5. Fill in the Name field.

  6. (Optional) Include a description of the rule.

  7. Select the target provisioning group.

  8. Click the Create Rule button.

    A page opens for the newly created provisioning rule. The rule status is DRAFT until you activate it.

  9. Add provisioning commands to a configuration associated with the rule:

    1. Click the Create Command button.

      A pop-up opens.

    2. Add the desired command to the configuration. The information required depends on which type of command you are adding.

      • If you are adding a Configuration, enter the key and value, then click the blue + button next to the value field. Repeat for each key-value pair you add.
    3. Click the Create Command button inside the pop-up.

    4. Repeat with additional commands as needed.

While the rule status is DRAFT, you can still edit the associated provisioning configuration and commands. Once the rule is activated, you can no longer edit it. Check your commands carefully before proceeding.

Once the rule is activated and a device attempts secure provisioning, the Provisioning Service checks if it meets the specified conditions. If a rule applies, the device begins executing the provisioning commands in the configuration associated with that rule.

Managing rules in the nRF Cloud portal

The Provisioning Rules page provides an overview of provisioning rules you have created, including status.

Once you have created a provisioning rule, you can activate, suspend, resume, or delete it.

caution

Once you activate a rule, you cannot change the commands under it or target conditions. You can only suspend, resume, or delete it. To avoid errors, refer to the best practices for provisioning rules. Carefully review your provisioning configurations before you activate the associated rule.

To activate a rule with DRAFT status:

  1. Go to the page for a specific provisioning rule.
  2. Click the Activate button.

The provisioning rule is now active. As you add devices to the indicated provisioning group, those devices check for new provisioning commands according to application configuration. While a rule is active, you can suspend, copy, or delete it.

If multiple rules apply to the same device, the device processes the associated configurations according to the time each rule was created, in chronological order. This means that the device processes commands from the oldest rule first. See Troubleshooting for more on how to address errors.

Managing provisioning rules through the APIs

This section outlines provisioning rule operations through the APIs.

Access

Endpoints for the Provisioning Service are available to admin and owner roles.

Before creating a rule, you must create a provisioning group to define the rule target.

Call the CreateProvisioningRule endpoint to create a new provisioning rule. Include the required name and tags parameters. The server responds with status 201 and information about the new rule, including its ID, name, description, tags, and status.

Once you have created a rule, see the Managing commands tab on this page to add commands.

If a rule is still in DRAFT status, you can call the UpdateProvisioningRule endpoint to update the name or tags associated with the rule. The server responds with status 200 and information about the rule with a new updatedAt time.

note

The service still processes an updated rule according to the createdAt time, not the updatedAt time.

Call the ListProvisioningRules endpoint to list all provisioning rules associated with your team and visible to your role. You can optionally filter rules according to their status. The server responds with status 200 and a list of all provisioning rules your role gives you access to.

Call the FetchProvisioningRule endpoint to fetch details for a specific provisioning rule. Include the rule-id parameter. The server responds with status 200 and information about the rule.