简体   繁体   English

如何使用 Azure CLI 访问 AAD B2C 租户

[英]How to access AAD B2C tenant with Azure CLI

I need to get user details in AAD B2C tenant I have access to:我需要在我有权访问的 AAD B2C 租户中获取用户详细信息:

az ad user show --id 0cbb4fd6-7091-44fb-ab5e-d2bd9c366f59

This cannot find the user because I'm logged into my organization regular AAD tenant.这找不到用户,因为我已登录到我的组织常规 AAD 租户。 B2C tenants do not have subscriptions, they're linked to the primary tenant which means I can't do B2C 租户没有订阅,他们链接到主要租户,这意味着我不能这样做

az login -t myb2ctenant.onmicrosoft.com

Working in the portal isn't handy, I'd like to do my routines in CLI.在门户中工作并不方便,我想在 CLI 中执行我的例程。 How can I do that?我怎样才能做到这一点?

There is an option on the AZ CLI to access tenants without subscriptions. AZ CLI 上有一个选项可以在没有订阅的情况下访问租户。 Change your command to:将您的命令更改为:

az login -t myb2ctenant.onmicrosoft.com --allow-no-subscriptions

Explanation from az login -h :来自az login -h的解释:

Support access tenants without subscriptions.支持无订阅访问租户。 It's uncommon but useful to run tenant level commands, such as 'az ad'.运行租户级别命令(例如“az ad”)并不常见但很有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM