简体   繁体   English

使用租户登录 Azure az

[英]Azure az login with tenant

I'm new to Azure stuff so this question may sound silly.我是 Azure 的新手,所以这个问题可能听起来很傻。

Can I login to sub-accounts in Azure using the CLI 2.0?我可以使用 CLI 2.0 登录 Azure 中的子帐户吗?

What I mean is to have an equivalent of powershell:我的意思是有一个相当于powershell的:

Login-AzureRmAccount -TenantId TENANT-GUID -SubscriptionId SUBSCRIPTION-GUID

I'm trying to automate creation of apps/service principals on our sub accounts.我正在尝试在我们的子帐户上自动创建应用程序/服务主体。 It appears that using PowerShell I can do it without any specific service principles on the sub accounts but when searching for answers about Azure CLI it's not clear if that is possible.似乎使用 PowerShell 我可以在子帐户上没有任何特定服务原则的情况下执行此操作,但是在搜索有关 Azure CLI 的答案时,尚不清楚这是否可行。

Thus the question how does one connect through Azure CLI 2.0 to a sub account with --tenant option ?因此,问题是如何通过 Azure CLI 2.0 连接到带有 --tenant 选项的子帐户?

the question how does one connect through Azure CLI 2.0 to a sub account with --tenant option ?问题如何通过 Azure CLI 2.0 连接到带有 --tenant 选项的子帐户?

Sub account, do you mean use Azure AD user account to login Azure via CLI 2.0?子账号,你的意思是使用Azure AD用户账号通过CLI 2.0登录Azure吗?

If I understand it correctly, we can use CLI command like this:如果我理解正确,我们可以像这样使用 CLI 命令:

az login -u jason.ye@xxxxx.onmicrosoft.com -p password -t 1fcfxxxx-xxxx-xxxx-xxxx-xxxx8bf8xxxx

More information about command az login , please refer to this link .有关命令az login更多信息,请参阅此链接

试试这个 CLI 命令:

az login --tenant <TenantID>

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

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