Skip to content
Endpoint ManagementMarkdown

Enroll a device again

Enroll a device again before its certificate's year is up, move it to its new record, and remove the old one.

API

Maya’s laptop was enrolled almost a year ago, and the date enroll printed then is close. Past it, the device client stops connecting, and the laptop’s security events and AI tools agent go quiet. You want it enrolled again before then, with no gap and no stale record left behind.

Enrolling again makes a new record, with a new device id and sensor id. The old record stays, and counts toward the realm’s device cap, until you remove it. Renewal over the device’s own connection, and re-enrollment into the same record, are planned.

  • You hold MODIFY on the realm’s endpoint settings (RealmOwner has it; see Who can call), with your session in $CVYUH_SESSION (Call the API).
  • Someone with administrator rights on the laptop, and the device address and sign-in address it was enrolled with.
  • The realm has room for one more device while both records exist (Device limits).
  • The date to enroll again before: enroll printed it at the last enrollment, and the realm doesn’t show it.
  1. Find the old record. List the realm’s devices and pick the one whose uid is maya-laptop:

    Terminal window
    curl https://foobar.cvyuh.com/api/v0/endpoint/ppm/v1 \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION"

    Keep its id as the old device id, and note any agents recorded on it.

  2. Make a token:

    Terminal window
    curl https://foobar.cvyuh.com/api/v0/endpoint/ppm/v1/enrolment-tokens \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
    -H "Content-Type: application/json" \
    -d '{"ttlHours": 4}'
  3. Enroll the laptop again, under a new name. While the old record exists, its sensor still holds the old name, and an enrollment under a name that’s held is refused:

    Terminal window
    sudo /var/cvyuh/bin/cvyuh-uem enroll --name maya-laptop-2 \
    --server <device address> --token <enrollment token> \
    --issuer https://foobar.cvyuh.com/oauth2

    It prints the new name and the next date to enroll again before. Note the date.

  4. Restart the device client, so it connects with its new certificate:

    Terminal window
    sudo systemctl restart cvyuh-uem
  5. Check the new record. List the realm’s devices again: maya-laptop-2 is there, active and connected. Keep its id. If agents were recorded on the old record, record them on the new one (Device records).

  6. Remove the old record, by the old device id:

    Terminal window
    curl -X DELETE https://foobar.cvyuh.com/api/v0/endpoint/ppm/v1/<old device id> \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION"

    The realm answers 202, and removes the old sensor registration with it.

Reading the old record answers 404 once its removal has finished, and the list holds one record for the laptop, maya-laptop-2, active and connected.

SymptomCauseFix
enroll is refused with 409, the name already heldThe name is in use, by this laptop’s old enrollment or another devicePick another name
enroll is refused with 409, the realm at its capBoth records need a place for a momentRemove a device you no longer need, or have the cap raised (Device limits)
The new record never shows connectedThe client wasn’t restarted, or can’t reach the device addressRestart it (step 4), then see the device client’s Troubleshooting
The date passed before you got to itThe client stopped connecting at the dateDo the same steps: enrolling again works on an expired device too

Until step 6 the old record is still there, but the laptop now holds only its new certificate, so it can’t go back to the old record. If the new enrollment can’t connect, fix that first (above) and remove the old record after.