I'm new to Azure stuff so this question may sound silly.

Can I login to sub-accounts in Azure using the CLI 2.0?

What I mean is to have an equivalent of 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.

Thus the question how does one connect through Azure CLI 2.0 to a sub account with --tenant option ?

2 Answers

Try this CLI command:

az login --tenant <TenantID> 

the question how does one connect through Azure CLI 2.0 to a sub account with --tenant option ?

Sub account, do you mean use Azure AD user account to login Azure via CLI 2.0?

If I understand it correctly, we can use CLI command like this:

az login -u -p password -t 1fcfxxxx-xxxx-xxxx-xxxx-xxxx8bf8xxxx 

More information about command az login, please refer to this link.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy