Skip to main content

Command Palette

Search for a command to run...

How to add Magento Cloud users via CLI

Published
2 min read
How to add Magento Cloud users via CLI
R

I work at LeSite as Technology Director, where I’m responsible for lead the technical team to building innovative products.

My passion for building software and sharing knowledge brought me to speak in over 14 conferences and create 21 projects used for more than 20,000 developers in the world. Now, I’m focused on helping merchants bringing innovation and technology strategy to their e-commerce ecosystem using the Magento 2, Adobe Commerce, Shopify Plus and other platforms.

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 your users you have these available commands.

Add a user to the project

magento-cloud user:add

Delete a user

magento-cloud user:delete

List project users

magento-cloud user:list [users]

View or change the user role

magento-cloud user:role

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

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

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

More from this blog

R

Rafael Corrêa Gomes - Ecommerce Developer

31 posts

Escrevo sobre desenvolvimento, e-commerce, Shopify, Magento, produtividade e carreira profissional.