# Provision Hardware

> Provision device hardware into Infuse-IoT Cloud.

The `provision` subcommand is responsible for collecting the information required to provision a piece of hardware in
Infuse-IoT, providing that information to the cloud, and flashing the result to the connected microcontroller.

For a general description of provisioning on Infuse-Iot, see the Embedded-SDK documentation:
[Device Provisioning](https://docs.dev.infuse-iot.com/latest/platform/provisioning.html#platform-provisioning).

## Running

The only required argument for the tool is the SoC manufacturer (`--nrf` or `--stm`)
so that the appropriate programming tools can be loaded.

```bash
infuse provision (--nrf | --stm)
```

If the board already exists in Infuse-IoT Cloud, the existing provisioning information will be re-written to the device.
Otherwise the tool will guide you through the process of provisioning new hardware.

### Provisioning new hardware

Provisioning a new device requires two crucial pieces of information and a third optional identifier:

- The type of board this device is.
- The organisation this device should belong to.
- An Infuse ID used to identify the device.

When omitted, the Infuse ID is autogenerated by the cloud and can be manually specified using `--id`:

```bash
infuse provision --nrf --id 0xaa00000000000001
```

<warning>

Once provisioned, the Infuse ID is permanently assigned to that specific unit of hardware
(enforced through internal SoC identifiers) and cannot be changed.

</warning>

If Board and Organisation IDs details are omitted the tool will automatically populate a list of organisation
and board IDs that can be selected to provision the hardware. Alternately the IDs can be directly provided using
the `--organisation` and `--board` arguments.

```bash
infuse provision --nrf --organisation 413c1966-9186-40da-b412-590afb10c301 --board 2a9fc6b7-d8d4-4fea-9a16-1790e0aa8c63
```

### Extra options

#### `--snr`: Programmer Serial Number

When multiple JTAG programmers are connected to the same system, `--snr` can be used the specify
the Serial Number of which JTAG programmer to use.

#### `--metadata`: Board Metadata

Some boards also have associated board metadata.
This can be supplied at provisioning with `--metadata KEY=VALUE [KEY=VALUE ...]`
