# Your first device

_For tartan 0.9.36._

Put a computer on your network: make a join code, run one line on the computer, and it joins as a service.

Put a computer on your network: make a join code, run one line on the computer, and it joins as a service.

You need an Owner, Admin or Tech role in the organization, and administrator rights on the computer.

## 1. Make a join code

In the console, open **Devices** and choose **Add a device** (Ctrl D). Leave **How many devices** on **One device**,
pick **Valid for**, the **Zone** and any **Tags**, then choose **Create code**. Your passkey approves it.

With the CLI, your passkey approves it too:

```sh
tartan code create --org acme --kind device --json
```

If the answer carries a `warning`, your organization isn't discoverable yet, and a join by link or QR code fails until
an Owner turns it on. Your passkey approves it:

```sh
tartan org set --org acme --key discoverable --value true
```

The device lands in the zone and with the tags the code names; with no `--zone`, the organization's default zone. A
device code lives 24 hours unless `--ttl` says otherwise (hours or minutes, such as `168h`; at most 7 days).

**The code is shown once.** The console's **Your code is ready** card, and the CLI's answer, give the code, its join
link (`link`), a QR code in the console, and the one-line installs (`install_lines`). Copy what you need, then choose
**Done, I've copied it**. Give the link only to the person installing that device.

## 2. Run the one line on the computer

**Windows.** Open PowerShell as an administrator and paste the Windows line from the card (`install_lines.windows`).

**Linux.** Paste the Linux line (`install_lines.linux`) into a terminal. It runs the installer with `sudo`.

The line checks the installer's SHA-256 before it runs it. The installer then checks every file it downloads against
the release's signatures, asks `Paste your join link`, installs the agent and joins. The link you paste stays hidden
and never goes on the command line.

**By hand on Windows.** Choose **Download** on the card for the MSI and run it. It asks **Join an organization
(optional)**: enter the organization's handle (`acme`) under **Organization** and the code under **Join code**, then
choose **Install**.

The install lines appear once your organization is in the Tartan registry ([Create your org](create-org.md)).

## 3. Approve it, if the code says so

A code made with `--require_approval` holds each device until someone approves it. It shows as **Waiting** in
**Devices**: open it and choose **Approve**. With the CLI:

```sh
tartan device list --org acme --schema tartan.device.v1 --json
tartan device approve --org acme --device <id> --dry-run --json
```

The dry run shows what the approval does. Then run it; your passkey approves it, every time:

```sh
tartan device approve --org acme --device <id> --json
```

In the console too, **Approve** asks for your passkey.

A code without it lets the device straight in.

## Check it worked

```sh
tartan device show --org acme --device <id> --schema tartan.device.v1 --json
```

`status` is `active`, `tunnel_up` is `true`, and `v6_addr` is the device's own IPv6 address on your network. In the
console the device shows under **Devices** with its address, zone and when it was last seen.

## Next

- [Windows and Linux](windows-linux.md)
- [Always on, from boot](always-on.md)
- [Device codes and fleet pushes](device-codes.md)
- [Add a site](add-site.md)
