Create a role assignment

POST/v1/directory/assignments

Gives a person or a group a role on one of your accounts. Only roles are assigned; a policy reaches people through the roles that hold it.

Permission: identity:CreateAccountAssignment. Changes need a sign-in that used a second factor.

Body

Field Type Description
permission_set_id string Required. The role's ID.
account_id integer Required. One of your accounts.
person_id string A person's ID. Send this or group_id, not both.
group_id string A group's ID.

Returns

201 Created

{
  "id": "c2d3e4f5-a6b7-4c8d-9e0f-1a2b3c4d5e6f",
  "permission_set_id": "5a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
  "account_id": 100000000123,
  "group_id": "3c5e8a90-1d2b-4e6f-8a7c-9b0d1e2f3a4b"
}

Errors

Besides the errors every call can return:

Status When
400 Not a role, an account that isn't yours, a role that doesn't go on that account, or neither or both of a person and a group.
404 No such resource in your organization.
409 That assignment already exists.

Example

curl -X POST https://<company>.yotta.bot/v1/directory/assignments \
  -H "Authorization: Bearer $YOTTABOT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"permission_set_id": "5a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d", "account_id": 100000000123, "group_id": "3c5e8a90-1d2b-4e6f-8a7c-9b0d1e2f3a4b"}'

With yottactl

yottactl org assignments create \
  --set permission_set_id=5a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d \
  --set account_id=100000000123 \
  --set group_id=3c5e8a90-1d2b-4e6f-8a7c-9b0d1e2f3a4b