DEV Community

loading...
Cover image for How to add Magento Cloud users via CLI

How to add Magento Cloud users via CLI

rafaelcg profile image Rafael Corrêa Gomes Originally published at rafaelcg.com ・2 min read

If you're a developer like me, for sure you will prefer to add new users via terminal via Magento Cloud CLI, not just add users, but you can edit, remove, list and edit the permissions via terminal. But in case you want to go to the visual way, I've written the post How to add new users to the Magento Cloud panel.

Magento CLI Commands

Specifically to control you users you have this available commands.

Add a user to the project

magento-cloud user:add
Enter fullscreen mode Exit fullscreen mode

Delete a user

magento-cloud user:delete
Enter fullscreen mode Exit fullscreen mode

List project users

magento-cloud user:list [users]
Enter fullscreen mode Exit fullscreen mode

View or change the user role

magento-cloud user:role
Enter fullscreen mode Exit fullscreen mode

The following examples use the CLI to add a user, configure roles, and modify project assignments and assigned user roles.

To add a user and assign roles:

Use the CLI to add the user. magento-cloud user:add

Follow the prompts to specify the user email address, set the project and environment roles, and add the user:

Enter the user's email address: alice@example.com

Email address: alice@example.com

The user's project role can be 'viewer' ('v') or 'admin' ('a').

Project role [V/a]: a

The user's environment-level roles can be 'viewer', 'contributor', or 'admin'.

development environment role [V/c/a]: c

Summary: Email address: alice@example.com

Project role: contributor

Adding users can result in additional charges.

Are you sure you want to add this user? [Y/n]

Adding the user to the project
Enter fullscreen mode Exit fullscreen mode

This operation triggers the Cloud build and deploy process, which takes your site offline until deployment completes. For production environments, we recommend completing this operation during off-peak hours to prevent service disruptions.

After you add the user, Magento sends an email to the specified address with instructions for accessing the Magento Commerce Cloud project.

The following example changes the environment-level role that is assigned to a user:

magento-cloud user:role alice@example.com --level environment --environment development --role admin

Enter fullscreen mode Exit fullscreen mode

The magento-cloud list command displays all the magento-cloud CLI commands.

Discussion (0)

Forem Open with the Forem app