Skip to content

Instantly share code, notes, and snippets.

@reubenmiller
Created August 15, 2025 08:29
Show Gist options
  • Save reubenmiller/7815af2999fe8591bf954622ad61c064 to your computer and use it in GitHub Desktop.
Save reubenmiller/7815af2999fe8591bf954622ad61c064 to your computer and use it in GitHub Desktop.
thin-edge.io tenant migration steps

Migrating thin-edge.io to a new Tenant with Basic Auth

  1. On your computer, register the device in Cumulocity using the bulk registration api to create a username/password for the device.

    c8y deviceregistration register-basic \
        --id tedge-flows-demo2 \
        --outputTemplate "std.manifestTomlEx({c8y:{username: output.username, password: output.password}}, '')"

    The command will output the toml that you will need for thin-edge.io

  2. Open a terminal on the device (using a Remote Access connection or a direct connection)

    If you're using systemd, then your Remote Access connection will be independent of the tedge-mapper-c8y and tedge-agent services, so the existing connection will not be disrupted if the mapper is disconnected.

  3. Create a file containing the basic auth username/password, by copying the output from the first step, it should look something like this (between the EOT blocks)

    cat <<EOT | sudo tee /etc/tedge/credentials.toml
    [c8y]
    username = "t9679/device_tedge-flows-demo"
    password = "<<redacted>>"
    EOT
  4. Change the auth method to basic (instead of certificate) and set the device.id (as with basic auth, there is not certificate to read the device.id from)

    sudo tedge config set c8y.auth_method basic
    sudo tedge config set device.id tedge-flows-demo
  5. Unset old settings, and clear some cache files (we know this isn't perfect atm)

    sudo tedge disconnect c8y
    sudo systemctl stop tedge-agent
    
    sudo tedge config unset c8y.http
    sudo tedge config unset c8y.mqtt
    sudo tedge config unset c8y.url
    
    sudo tedge cert remove
    sudo rm -f /etc/tedge/.agent/entity_store.jsonl
  6. Set the url of the new tenant

    sudo tedge config set c8y.url iot.latest.stage.c8y.io

    Or if you're using a custom domain, then you'll need to set

    sudo tedge config set c8y.http <custom_domain_http_endpoint>
    sudo tedge config set c8y.mqtt <c8y_mqtt_endpoint>
  7. Connect to the new tenant

    sudo tedge connect c8y
  8. On your computer, switch to the go-c8y-cli session related to your

  9. Create a new passthrough connection on the newly created device in the ne

    c8y remoteaccess configurations create-passthrough --device tedge-flows-demo --name native-ssh --port 22 --hostname 127.0.0.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment