b2c-am

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

B2C Account Manager Skill

B2C Account Manager 技能

Use the
b2c am
commands to manage Account Manager resources: API clients, users, roles, and organizations.
Tip: If
b2c
is not installed globally, use
npx @salesforce/b2c-cli
instead (e.g.,
npx @salesforce/b2c-cli am clients list
).
使用
b2c am
命令管理 Account Manager 资源:API 客户端、用户、角色和组织。
提示: 如果没有全局安装
b2c
,请改用
npx @salesforce/b2c-cli
(例如:
npx @salesforce/b2c-cli am clients list
)。

Authentication

身份验证

Account Manager commands work out of the box with no configuration. The CLI uses a built-in public client and opens a browser for login.
  • Zero-config (browser login): Default. Just run the commands -- the CLI opens a browser for login.
  • Client credentials: For CI/CD and automation. Pass
    --client-id
    and
    --client-secret
    (or set
    SFCC_CLIENT_ID
    and
    SFCC_CLIENT_SECRET
    env vars).
  • Force browser login (
    --user-auth
    ):
    When client credentials are configured but you need browser-based login (required for org and client management).
Account Manager 命令无需配置即可开箱即用。CLI 使用内置的公共客户端,会打开浏览器进行登录。
  • 零配置(浏览器登录): 默认方式。直接运行命令即可,CLI 会打开浏览器供你登录。
  • 客户端凭证: 适用于 CI/CD 和自动化场景。传入
    --client-id
    --client-secret
    参数(或者设置
    SFCC_CLIENT_ID
    SFCC_CLIENT_SECRET
    环境变量)。
  • 强制浏览器登录(
    --user-auth
    ):
    当已经配置了客户端凭证,但你需要使用基于浏览器的登录时使用(组织和客户端管理操作需要此模式)。

Role Requirements

角色要求

OperationsClient Credentials (roles on API client)User Auth (roles on user account)
Users & RolesUser AdministratorAccount Administrator or User Administrator
OrganizationsNot supported -- use
--user-auth
Account Administrator
API ClientsNot supported -- use
--user-auth
Account Administrator or API Administrator
Organization and API client management are only available with user authentication.
操作客户端凭证(API 客户端上的角色)用户授权(用户账户上的角色)
用户与角色User AdministratorAccount Administrator 或 User Administrator
组织不支持 -- 请使用
--user-auth
Account Administrator
API 客户端不支持 -- 请使用
--user-auth
Account Administrator 或 API Administrator
组织和 API 客户端管理仅支持用户授权模式。

API Clients

API 客户端

List Clients

列出客户端

bash
b2c am clients list
bash
b2c am clients list

with pagination

带分页

b2c am clients list --size 50 --page 2
b2c am clients list --size 50 --page 2

JSON output

JSON 格式输出

b2c am clients list --json
undefined
b2c am clients list --json
undefined

Get Client

获取客户端详情

bash
undefined
bash
undefined

by UUID

通过 UUID 查询

b2c am clients get <api-client-id>
b2c am clients get <api-client-id>

with expanded organizations and roles

展开返回关联的组织和角色信息

b2c am clients get <api-client-id> --expand organizations --expand roles
undefined
b2c am clients get <api-client-id> --expand organizations --expand roles
undefined

Create Client

创建客户端

Clients are created inactive by default. Requires user auth.
bash
b2c am clients create \
  --name "My API Client" \
  --orgs <org-id> \
  --password "securePassword123"
客户端默认创建为未激活状态,需要用户授权模式。
bash
b2c am clients create \
  --name "My API Client" \
  --orgs <org-id> \
  --password "securePassword123"

with roles, role tenant filter, and redirect URLs

配置角色、角色租户过滤器和重定向 URL

b2c am clients create
--name "CI/CD Pipeline"
--orgs <org-id>
--password "securePassword123"
--roles SALESFORCE_COMMERCE_API
--role-tenant-filter "SALESFORCE_COMMERCE_API:zzxy_prd"
--redirect-urls "https://example.com/callback"
--active
undefined
b2c am clients create
--name "CI/CD Pipeline"
--orgs <org-id>
--password "securePassword123"
--roles SALESFORCE_COMMERCE_API
--role-tenant-filter "SALESFORCE_COMMERCE_API:zzxy_prd"
--redirect-urls "https://example.com/callback"
--active
undefined

Update Client

更新客户端

Partial update -- only specified fields are changed.
bash
b2c am clients update <api-client-id> --name "New Name"
b2c am clients update <api-client-id> --active
局部更新 -- 仅修改指定的字段。
bash
b2c am clients update <api-client-id> --name "New Name"
b2c am clients update <api-client-id> --active

Change Client Password

修改客户端密码

bash
b2c am clients password <api-client-id> --current "oldPass" --new "newSecurePass123"
bash
b2c am clients password <api-client-id> --current "oldPass" --new "newSecurePass123"

Delete Client

删除客户端

Client must be disabled for 7+ days before deletion. Destructive operation (safe mode check).
bash
b2c am clients delete <api-client-id>
客户端必须先禁用满7天才能删除。这是破坏性操作(会进行安全模式检查)。
bash
b2c am clients delete <api-client-id>

Users

用户

List Users

列出用户

bash
b2c am users list
bash
b2c am users list

with extended columns (roles, organizations)

展示扩展列(角色、组织)

b2c am users list --extended
b2c am users list --extended

JSON output with pagination

JSON 格式输出带分页

b2c am users list --size 100 --json
undefined
b2c am users list --size 100 --json
undefined

Get User

获取用户详情

bash
b2c am users get user@example.com
bash
b2c am users get user@example.com

with expanded roles and organizations

展开返回关联的角色和组织信息

b2c am users get user@example.com --expand-all
undefined
b2c am users get user@example.com --expand-all
undefined

Create User

创建用户

bash
b2c am users create \
  --org "My Organization" \
  --mail user@example.com \
  --first-name Jane \
  --last-name Doe
The
--org
flag accepts either an org ID or org name. Users are created in INITIAL state with no roles.
bash
b2c am users create \
  --org "My Organization" \
  --mail user@example.com \
  --first-name Jane \
  --last-name Doe
--org
参数支持传入组织 ID 或者组织名称。用户创建后默认处于 INITIAL 状态,没有绑定任何角色。

Update User

更新用户

bash
b2c am users update user@example.com --first-name Janet --last-name Smith
bash
b2c am users update user@example.com --first-name Janet --last-name Smith

Delete User

删除用户

Soft-deletes by default. Use
--purge
for hard delete (user must already be in DELETED state).
bash
undefined
默认执行软删除。使用
--purge
参数进行硬删除(用户必须已处于 DELETED 状态)。
bash
undefined

soft delete

软删除

b2c am users delete user@example.com
b2c am users delete user@example.com

hard delete (purge)

硬删除(永久清除)

b2c am users delete developer@example.com --purge
undefined
b2c am users delete developer@example.com --purge
undefined

Reset User Password

重置用户密码

Resets password to INITIAL state, clearing expiration. Destructive operation (safe mode check).
bash
b2c am users reset user@example.com
将密码重置为 INITIAL 状态,清除过期时间。这是破坏性操作(会进行安全模式检查)。
bash
b2c am users reset user@example.com

Roles

角色

List Roles

列出角色

bash
b2c am roles list
bash
b2c am roles list

filter by target type

按目标类型筛选

b2c am roles list --target-type User b2c am roles list --target-type ApiClient
undefined
b2c am roles list --target-type User b2c am roles list --target-type ApiClient
undefined

Get Role

获取角色详情

bash
b2c am roles get bm-admin
b2c am roles get SLAS_ORGANIZATION_ADMIN
bash
b2c am roles get bm-admin
b2c am roles get SLAS_ORGANIZATION_ADMIN

Grant Role to User

为用户授予角色

bash
b2c am roles grant user@example.com --role bm-admin
bash
b2c am roles grant user@example.com --role bm-admin

with tenant scope

限定租户范围

b2c am roles grant user@example.com --role bm-admin --scope zzzz_001,zzzz_002
undefined
b2c am roles grant user@example.com --role bm-admin --scope zzzz_001,zzzz_002
undefined

Revoke Role from User

撤销用户的角色

bash
undefined
bash
undefined

revoke entire role

撤销整个角色

b2c am roles revoke user@example.com --role bm-admin
b2c am roles revoke user@example.com --role bm-admin

revoke specific tenant scopes only

仅撤销指定租户范围的角色权限

b2c am roles revoke user@example.com --role bm-admin --scope zzzz_001
undefined
b2c am roles revoke user@example.com --role bm-admin --scope zzzz_001
undefined

Organizations

组织

List Organizations

列出组织

bash
b2c am orgs list
bash
b2c am orgs list

all organizations (max page size)

列出所有组织(最大分页大小)

b2c am orgs list --all
b2c am orgs list --all

extended columns

展示扩展列

b2c am orgs list --extended
undefined
b2c am orgs list --extended
undefined

Get Organization

获取组织详情

Accepts org ID or name.
bash
b2c am orgs get <org-id>
b2c am orgs get "My Organization"
支持传入组织 ID 或者组织名称。
bash
b2c am orgs get <org-id>
b2c am orgs get "My Organization"

Common Workflows

常见工作流

User Onboarding

用户入职

bash
undefined
bash
undefined

Create the user

创建用户

b2c am users create --org $ORG_ID --mail developer@example.com
--first-name Alex --last-name Developer
b2c am users create --org $ORG_ID --mail developer@example.com
--first-name Alex --last-name Developer

Grant Business Manager Admin role scoped to a specific tenant

授予指定租户范围的 Business Manager 管理员角色

b2c am roles grant developer@example.com --role bm-admin --scope zzxy_prd
undefined
b2c am roles grant developer@example.com --role bm-admin --scope zzxy_prd
undefined

User Offboarding

用户离职

bash
undefined
bash
undefined

Revoke roles

撤销角色

b2c am roles revoke developer@example.com --role bm-admin
b2c am roles revoke developer@example.com --role bm-admin

Soft delete the user

软删除用户

b2c am users delete developer@example.com
b2c am users delete developer@example.com

Permanent deletion (user must be in DELETED state first)

永久删除(用户必须先处于 DELETED 状态)

b2c am users delete developer@example.com --purge
undefined
b2c am users delete developer@example.com --purge
undefined

Bulk Operations with JSON

基于 JSON 的批量操作

bash
undefined
bash
undefined

Export all users as JSON

导出所有用户为 JSON 格式

b2c am users list --size 4000 --json
b2c am users list --size 4000 --json

Pipe to jq for filtering

管道传输到 jq 进行筛选

b2c am users list --json | jq '.[] | select(.userState == "ACTIVE")'
undefined
b2c am users list --json | jq '.[] | select(.userState == "ACTIVE")'
undefined

Common Patterns

通用规则

All
am
commands support
--json
for programmatic output. List commands support
--columns
,
--extended
,
--size
, and
--page
for pagination and column control.
Destructive operations (user delete, user reset, client delete) check safe mode. Only delete or purge users when explicitly requested.
所有
am
命令都支持
--json
参数输出可编程使用的格式。列表类命令支持
--columns
--extended
--size
--page
参数进行分页和列展示控制。
破坏性操作(用户删除、用户密码重置、客户端删除)会进行安全模式检查,仅在显式请求时才会执行删除或清除操作。

More Commands

更多命令

See
b2c am --help
for a full list of available commands and options.
查看
b2c am --help
获取完整的可用命令和参数列表。