你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

az ad user

管理Microsoft Entra 用户。

命令

名称 说明 类型 Status
az ad user create

创建一个用户。

Core GA
az ad user delete

删除用户。

Core GA
az ad user get-member-groups

获取用户所属的组。

Core GA
az ad user list

列出用户。

Core GA
az ad user show

获取用户的详细信息。

Core GA
az ad user update

更新用户。

Core GA

az ad user create

创建一个用户。

az ad user create --display-name
                  --password
                  --user-principal-name
                  [--force-change-password-next-sign-in {false, true}]
                  [--immutable-id]
                  [--mail-nickname]

示例

创建用户

az ad user create --display-name myuser --password password --user-principal-name myuser@contoso.com

必需参数

--display-name

对象的显示名称或其前缀。

--password

应分配给用户进行身份验证的密码。

--user-principal-name

用户主体名称(someuser@contoso.com)。 它必须包含租户的已验证域之一。

可选参数

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--force-change-password-next-sign-in

在下次进行身份验证时,将此用户标记为需要更新其密码。 如果省略,将使用 false。

属性
默认值: False
接受的值: false, true
--immutable-id

此属性用于将本地 Active Directory用户帐户与其Microsoft Entra用户对象相关联。 如果在对用户的 userPrincipalName (UPN) 属性使用联合域,则必须在 Graph 中创建新用户帐户时指定此属性。 注意:指定此属性时不能使用 $ 和 _ 字符。

--mail-nickname

邮件别名。 默认为用户主体名称。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

仅显示错误,禁止显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az ad user delete

删除用户。

az ad user delete --id

示例

删除用户。

az ad user delete --id myuser@contoso.com

必需参数

--id

要获取其信息的用户的对象 ID 或主体名称。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

仅显示错误,禁止显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az ad user get-member-groups

获取用户所属的组。

az ad user get-member-groups --id
                             [--security-enabled-only {false, true}]

示例

获取用户所属的组

az ad user get-member-groups --id myuser@contoso.com

必需参数

--id

要获取其信息的用户的对象 ID 或主体名称。

可选参数

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--security-enabled-only

如果指定仅应返回实体所属的安全组,则为 True;false 指定应返回实体所属的所有组和目录角色。

属性
默认值: False
接受的值: false, true
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

仅显示错误,禁止显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az ad user list

列出用户。

az ad user list [--display-name]
                [--filter]
                [--upn]

示例

列出所有用户。

az ad user list

可选参数

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--display-name

对象的显示名称或其前缀。

--filter

OData 筛选器,例如 --filter “displayname eq 'test' and servicePrincipalType eq 'Application'”。

--upn

用户主体名称,例如 john.doe@contoso.com。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

仅显示错误,禁止显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az ad user show

获取用户的详细信息。

az ad user show --id

示例

显示用户。

az ad user show --id myuser@contoso.com

必需参数

--id

要获取其信息的用户的对象 ID 或主体名称。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

仅显示错误,禁止显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az ad user update

更新用户。

az ad user update --id
                  [--account-enabled {false, true}]
                  [--display-name]
                  [--force-change-password-next-sign-in {false, true}]
                  [--mail-nickname]
                  [--password]

示例

更新用户。

az ad user update --id myuser@contoso.com --display-name username2

必需参数

--id

要获取其信息的用户的对象 ID 或主体名称。

可选参数

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--account-enabled

启用用户帐户。

属性
接受的值: false, true
--display-name

对象的显示名称或其前缀。

--force-change-password-next-sign-in

如果用户必须在下一次登录时更改密码。

属性
接受的值: false, true
--mail-nickname

邮件别名。 默认为用户主体名称。

--password

用户密码。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

仅显示错误,禁止显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False