Assign an api key to more than one project

Hi everyone,

The api key creation and project assignment syntax only shows the option to list a single project..

Is there a way to assign an api key to more than one project?

Hi @Nivi_Mor1

This example is assigning an existing api key 673d1c592178de088b1492f0 to another project 588fc162d383ad09d65f7ae2:

atlas projects apiKeys assign 673d1c592178de088b1492f0 --role GROUP_OWNER --projectId 588fc162d383ad09d65f7ae2

Here is the output of describe showing it as an Org_Member of my organization and Group_Owner of two projects.

atlas organizations apiKeys describe 673d1c592178de088b1492f0 -o json
{
  "desc": "key0",
  "id": "673d1c592178de088b1492f0",
  "links": [
    {
      "href": "https://cloud.mongodb.com/api/atlas/v2/orgs/599ef3039f78f769464dc547/apiKeys/673d1c592178de088b1492f0",
      "rel": "self"
    }
  ],
  "privateKey": "********-****-****-8e1f18d1422a",
  "publicKey": "fcpwktvo",
  "roles": [
    {
      "groupId": "588fc162d383ad09d65f7ae2",
      "roleName": "GROUP_OWNER"
    },
    {
      "orgId": "599ef3039f78f769464dc547",
      "roleName": "ORG_MEMBER"
    },
    {
      "groupId": "664558580333232c97f65b94",
      "roleName": "GROUP_OWNER"
    }
  ]
}


@chris thanks for your reply that’s exactly what I was looking for.
Too bad this is not explicitly mentioned in the docs.

Thanks again!

You’re welcome @Nivi_Mor1

On each docs page there is a “Rate This Page” that can be used to submit a rating and suggestions.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.