How to Configure and Connect to Cumulocity IoT in Rasbery Pi?

Product/components used and version/fix level:

Cumulocity IoT

Detailed explanation of the problem:

I have tried to connect the Cumulocity IoT account to the raspberry pi using the c8y command using thing-edge io in step 2

but this step displays the error and can not connect Cumulocity account

Error messages / full error message screenshot / log file:

Question related to a free trial, or to a production (customer) instance?

free trial
my tenant id:- aatif312

Hi Aatif, to upload the certificate, you need to give your username not the tenant id in the command. Please try again with your username.

Hi Yishu Zhong,I also try the username but gives the same error

Hi Aatif, error 401 means credentials are invalid. Please make sure the combination of user and password is correct. The second password you enter should be the password of your Cumulocity account. You can also use tedge config list command to check if the URL and other settings are correct.

Are you using a single sign on user, as I believe this is the default for trial tenants (though I’m not 100% sure about this). If so you can create another user in your tenant which has the “Tenant Management” permissions to use for the certificate uploads.

Alternatively you can always manually upload the device public certificate in the Cumulocity IoT Device Management UI.

  1. On the device, display the certificate on the console (if you get permission denied, then run the command again using sudo)

    cat /etc/tedge/device-certs/tedge-certificate.pem
    

    You should get something like this. Note: This this is just the public certificate, so there is no danger if other people see it.

    -----BEGIN CERTIFICATE-----
    MIIBtTCCAVugAwIBAgIHK5b1o5D1dzAKBggqhkjOPQQDAjBHMRswGQYDVQQDDBJ0
    ZWRnZV9jMmQwYTg4OThmOTYxEjAQBgNVBAoMCVRoaW4gRWRnZTEUMBIGA1UECwwL
    VGVzdCBEZXZpY2UwHhcNMjMwNTMwMDkyNjQ4WhcNMjQwNTI5MDkyNjQ4WjBHMRsw
    GQYDVQQDDBJ0ZWRnZV9jMmQwYTg4OThmOTYxEjAQBgNVBAoMCVRoaW4gRWRnZTEU
    MBIGA1UECwwLVGVzdCBEZXZpY2UwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQq
    tFS59Vg9oX7/VjF4b1lH78bsQNoVwv8iNuNXPCwy1WwHALMx3r1K2pCzLcd6Z60L
    PRxXx5htw5kaN1XReHNmozIwMDAdBgNVHQ4EFgQUd/WQo/WWKwA071JAJ0NquEsr
    cOcwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAgNIADBFAiEAxyPLPsFAZZxD
    M2N9qgTJCLQ1ACESSxGOdo9Nni8WRP8CIFR2IVoYslANLbt3wgkMgyDyAkpl0+/2
    wZP4DYPx8602
    -----END CERTIFICATE-----
    
  2. Copy the printed certificate text (including the -----BEGIN CERTIFICATE----- and -----END CERTIFICATE----- lines) and save it to a file on your local machine (e.g. device-001-certificate.pem)

  3. Open a browser and navigate to your Tenant, and open the Device Management UI application

  4. Navigate to Management > Trusted Certificates

  5. Click Add trusted certificate (in the top right corner). Activate auto registration and Enable options. (Note: the certificate name does not matter too much, but using a descriptive name is always helpful for your future self). Upload the certificate file you saved locally in step 2.

  6. On the device, you can speed up the reconnection attempt by reconnecting

    sudo tedge reconnect c8y
    

Note Your Cumulocity IoT user must have the Tenant Manager role (and adding this will require you to log out and log in again in the UI)

I checked - there is no tenant https://aatif312.cumulocity.com/.
That’s why you get the 401.
Why do you think this is the tenant url?

So how can I get my tenant Role in Cumulocity Iot Account?

Have you got a tenant?

Yes I have created one tenant from the administration account

What you are showing me there is a user account, with Tenant manager permissions. What is the tenant in which you are doing this? What is the url in the address bar at the top of the screen?

this is my URL

https://aatif312.eu-latest.cumulocity.com/apps/administration/index.html

In your case the c8y.url should be

aatif312.eu-latest.cumulocity.com

You were incorrectly using aatif312.cumulocity.com before.

https://aatif312.eu-latest.cumulocity.com/apps/administration/index.html

Your output early on in this thread shows cumulocity.com, not eu-latest.

Same Error :frowning_face:
What am I doing wrong?

The user aatif312 does not exist. Instead you should a user name that is provided in your user management view you’ve posted above (and have the Tenant Manager role).
I think you have common misunderstanding about tenants and user… What you’ve created is a user in a specific tenant.

Sorry but I can’t understand what you say about the tenant, could you brief detail about this?

What did I do wrong?

What you think is a “user” is actually a tenant.
When you do this:
tedge cert upload c8y --user "aatif312"there is no user “aatif312” in your tenant “aatif312” but users systemuser, aatif_jariwala2 … etc.

So
How can I log in to the aatif_jariwala2 account in Cumulocity?

If I log in to this tenant Where to get the tenant environment for login purposes?

The tenant is aatif312.eu-latest.cumulocity.com.

On that tenant there are four user accounts one of which is ‘aatif_jariwala’.

It is this account you should specify as --user in the tedge command, and when prompted type the password for it.