Creating and managing users with the UAA CLI (UAAC)
Page last updated:
Using the Cloud Foundry User Account and Authentication Command Line Interface (UAAC), you can create users in the UAA server.
The UAAC only creates users in UAA, and does not assign roles in the Cloud Controller database (CCDB). In general, admins create users using the Cloud Foundry Command Line Interface (cf CLI). The cf CLI both creates user records in the UAA and associates them with org and space roles in the CCDB. Before admins can assign roles to the user, the user must log in through Apps Manager or the cf CLI for the user record to populate the CCDB.
For more information on creating and managing users, see Creating and Managing Users with the cf CLI.
For more information, see UAA Overview, UAA Sysadmin Guide in the UAA repository on GitHub, and Docs in the UAA repository on GitHub.
For more information about which roles can perform various operations in Cloud Foundry, see User roles in Orgs, Spaces, Roles, and Permissions.
Create an admin user
To create an admin user for UAA:
Install the UAAC by running:
gem install cf-uaacTarget your UAA server by running:
uaac target uaa.UAA-DOMAINWhere
UAA-DOMAINis the domain of your UAA server.Record the
uaa:admin:client_secretfrom your deployment manifest.Authenticate and obtain an access token for the admin client from the UAA server by running:
uaac token client get admin -s ADMIN-CLIENT-SECRETWhere
ADMIN-CLIENT-SECRETis the admin secret you recorded in the previous step.
UAAC stores the token in~/.uaac.yml.Display the users and apps authorized by the UAA server, as well as the permissions granted to each user and app, by running:
uaac contextsIn the output from
uaac contexts, check thescopesection of theclient_id: adminuser forscim.write. The valuescim.writerepresents sufficient permissions to create accounts.If the admin user lacks permissions to create accounts, add the permissions:
Add the necessary permissions to the admin user account on the UAA server by running:
uaac client update admin --authorities "EXISTING-PERMISSIONS scim.write"Where
EXISTING-PERMISSIONSis the current contents of thescopesection from the output fromuaac contexts.Delete the local token by running:
uaac token deleteObtain an updated access token from the UAA server by running:
uaac token client get admin
Create an admin user by running:
uaac user add NEW-ADMIN-USERNAME -p NEW-ADMIN-PASSWORD --emails NEW-ADMIN-EMAILWhere:
NEW-ADMIN-USERNAMEis the username you want to give the admin user.NEW-ADMIN-PASSWORDis the password you want to give the admin user.NEW-ADMIN-EMAILis the email address of the admin user.
Add the new admin user to the groups
cloud_controller.admin,uaa.admin,scim.read, andscim.writeby running:uaac member add GROUP NEW-ADMIN-USERNAMEWhere:
GROUPis the name of the group to which you want to add the new admin user.NEW-ADMIN-USERNAMEis the username of the new admin user.
Create an admin read-only user
The admin read-only account can view but not modify almost all Cloud Controller API resources. The admin read-only account cannot view process stats or logs.
To create an admin read-only user account:
Obtain the credentials of the admin client you created in Create an Admin User, or see the
uaa: scimsection of your deployment manifest for the user name and password of an admin user.Authenticate and obtain an access token for the admin client from the UAA server by running:
uaac token client get admin -s ADMIN-CLIENT-SECRETWhere
ADMIN-CLIENT-SECRETis the admin secret you recorded in the previous step.
UAAC stores the token in~/.uaac.yml.Create an admin read-only user by running:
uaac user add NEW-ADMIN-RO-USERNAME -p NEW-ADMIN-RO-PASSWORD --emails NEW-ADMIN-RO-EMAILWhere:
NEW-ADMIN-RO-USERNAMEis the username you want to give the admin read-only user.NEW-ADMIN-RO-PASSWORDis the password you want to give the admin read-only user.NEW-ADMIN-RO-EMAILis the email address of the admin read-only user.
Add the new admin user to the groups
cloud_controller.admin_read_onlyandscim.readby running:uaac member add GROUP NEW-ADMIN-RO-USERNAMEWhere:
GROUPis the name of the group to which you want to add the new admin read-only user.NEW-ADMIN-RO-USERNAMEis the username of the new admin read-only user.
Create a global auditor
The global auditor account has read-only access to almost all Cloud Controller API resources but cannot access secret data such as environment variables. The global auditor account cannot view process stats or logs.
To create a global auditor account:
Obtain the credentials of the admin client you created in Create an admin user, or see the
uaa: scimsection of your deployment manifest for the user name and password of an admin user.Authenticate and obtain an access token for the admin client from the UAA server by running:
uaac token client get admin -s ADMIN-CLIENT-SECRETWhere
ADMIN-CLIENT-SECRETis the admin secret you recorded in the previous step.
UAAC stores the token in~/.uaac.yml.Create a global auditor user by running:
uaac user add NEW-GLOBAL-AUDITOR-USERNAME -p NEW-GLOBAL-AUDITOR-PASSWORD --emails NEW-GLOBAL-AUDITOR-EMAILWhere:
NEW-GLOBAL-AUDITOR-USERNAMEis the username you want to give the admin read-only user.NEW-GLOBAL-AUDITOR-PASSWORDis the password you want to give the admin read-only user.NEW-GLOBAL-AUDITOR-EMAILis the email address of the admin read-only user.
To ensure that the
cloud_controller.global_auditorgroup exists, run:uaac group add cloud_controller.global_auditorAdd the new global auditor user to the
cloud_controller.global_auditorgroup by running:uaac member add GROUP NEW-GLOBAL-AUDITOR-USERNAMEWhere:
GROUPis the name of the group to which you want to add the new global auditor user.NEW-GLOBAL-AUDITOR-USERNAMEis the username of the new global auditor user.
Grant admin permissions to an external group (SAML, LDAP, or OIDC)
To grant all users under an external group admin permissions:
Obtain the credentials of the admin client you created in Create an Admin User, or see the
uaa: scimsection of your deployment manifest for the user name and password of an admin user.Authenticate and obtain an access token for the admin client from the UAA server by running:
uaac token client get admin -s ADMIN-CLIENT-SECRETWhere
ADMIN-CLIENT-SECRETis the admin secret you recorded in the previous step.
UAAC stores the token in~/.uaac.yml.Follow the procedure that corresponds to your use case:
The UAA does not grant scopes for users in external groups until the next time the user logs in. This means that users granted scopes from external group mappings must log out from Cloud Foundry and log back in before their new scope takes effect.
Grant admin permissions for LDAP
To grant admin permissions to all users under the mapped LDAP group:
Run:
uaac group map --name scim.read "GROUP-DISTINGUISHED-NAME"Where
GROUP-DISTINGUISHED-NAMEis the name of the LDAP group.Run:
uaac group map --name scim.write "GROUP-DISTINGUISHED-NAME"Where
GROUP-DISTINGUISHED-NAMEis the name of the LDAP group.Run:
uaac group map --name cloud_controller.admin "GROUP-DISTINGUISHED-NAME"Where
GROUP-DISTINGUISHED-NAMEis the name of the LDAP group.
Grant admin permissions for SAML and OIDC
To grant admin permissions to all users under the mapped SAML or OIDC group:
Retrieve the name of your SAML provider by opening your Cloud Foundry manifest and recording the value of the
login.saml.providers.provider-nameproperty.Grant all users under the mapped SAML or OIDC group admin permissions by running:
uaac group map --name scim.read "GROUP-NAME" --origin PROVIDER-NAME uaac group map --name scim.write "GROUP-NAME" --origin PROVIDER-NAME uaac group map --name cloud_controller.admin "GROUP-NAME" --origin PROVIDER-NAMEWhere:
GROUP-NAMEis the name of the SAML or OIDC group.PROVIDER-NAMEis the name of your SAML or OIDC IDP.
For OIDC, make sure you configure the IDP’s attribute mappings and map external_groups to the groups field in the
OIDC ID Token issued by the IDP.
Create users
To create new users:
Obtain the credentials of the admin client you created in Create an Admin User, or see the
uaa: scimsection of your deployment manifest for the username and password of an admin user.Log in to your UAA API by running:
cf login -u ADMIN-USERNAME -p ADMIN-PASSWORDWhere:
ADMIN-USERNAMEis the username of the admin user.ADMIN-PASSWORDis the password of the admin user.
Create a new user by running:
cf create-user NEW-USERNAME NEW-USER-PASSWORDWhere:
NEW-USERNAMEis the username you give the new user.NEW-USER-PASSWORDis the password you give the new user.
You can use the
--password-promptoption to prompt for the password. This enhances security by removing the requirement to type the password on the command line.
Change passwords
To change the password of a user:
Obtain the credentials of the admin client you created in Create an Admin User, or see the
uaa: scimsection of your deployment manifest for the user name and password of an admin user.Authenticate and obtain an access token for the admin client from the UAA server by running:
uaac token client get admin -s ADMIN-CLIENT-SECRETWhere
ADMIN-CLIENT-SECRETis the admin secret you recorded in the previous step.
UAAC stores the token in~/.uaac.yml.Display the users and apps authorized by the UAA server, as well as the permissions granted to each user and app, by running:
uaac contextsIn the output from
uaac contexts, check thescopesection of theclient_id: adminuser forpassword.write. The valuepassword.writerepresents sufficient permissions to change passwords.If the admin user lacks permissions to change passwords, add the permissions:
Add the necessary permissions to the admin user account on the UAA server by running:
uaac client update admin --authorities "EXISTING-PERMISSIONS password.write"Where
EXISTING-PERMISSIONSis the current contents of thescopesection from the output fromuaac contexts.Delete the local token by running:
uaac token deleteObtain an updated access token from the UAA server by running:
uaac token client get admin
Change an existing user password to a temporary password by running:
uaac password set USERNAME -p TEMP-PASSWORDWhere:
USERNAMEis the username of the user whose password you want to change.TEMP-PASSWORDis the temporary password you set.
Provide the temporary password to the user and instruct the user to run:
cf target api.UAA-DOMAIN cf login -u USERNAME -p TEMP-PASSWORD cf passwdWhere:
UAA-DOMAINis the domain of your UAA server.USERNAMEis the username of the user.TEMP-PASSWORDis the temporary password you provided the user.
Retrieve user email addresses
Some Cloud Foundry components, like Cloud Controller, only use GUIDs for user identification. You can use UAA to retrieve the emails of your Cloud Foundry instance users either as a list or, for a specific user, with that user’s GUID.
Target your UAA server by running:
uaac target uaa.UAA-DOMAINWhere
UAA-DOMAINis the domain of your UAA server.Record the
uaa:admin:client_secretfrom your deployment manifest.Authenticate and obtain an access token for the admin client from the UAA server by running:
uaac token client get admin -s ADMIN-CLIENT-SECRETWhere
ADMIN-CLIENT-SECRETis the admin secret you recorded in the previous step.
UAAC stores the token in~/.uaac.yml.Display the users and apps authorized by the UAA server, as well as the permissions granted to each user and app, by running:
uaac contextsIn the output from
uaac contexts, check thescopesection of theclient_id: adminuser forscim.write. The valuescim.writerepresents sufficient permissions to query the UAA server for user information.If the admin user lacks permissions to change passwords, add the permissions:
Add the necessary permissions to the admin user account on the UAA server by running:
uaac client update admin --authorities "EXISTING-PERMISSIONS scim.write"Where
EXISTING-PERMISSIONSis the current contents of thescopesection from the output fromuaac contexts.Delete the local token by running:
uaac token deleteObtain an updated access token from the UAA server by running:
uaac token client get admin
To list your Cloud Foundry instance users, run:
uaac usersBy default, the
uaac userscommand returns information about each user account, including GUID, name, permission groups, activity status, and metadata. To limit the output ofuaac usersto email addresses, run:uaac users --attributes emailsTo retrieve a specific user’s email address, run:
uaac users "id eq GUID" --attributes emailsWhere
GUIDis the GUID of a specific user.