How to use connect-azaccount cmdlet to connect to multiple tenants

Muhammad Suhail Asrulsani 1 Reputation point


I want to loop Connect-AzAccount cmdlet to a multiple tenant without prompting for password and MFA.

When connecting to my own tenant, I can connect using below command.

Connect-AzAccount  -ServicePrincipal -ApplicationId $ApplicationId -Tenant $TenantID -CertificateThumbprint $ThumbprintID

It is not working when trying to connect to different tenant. Please advise

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
1,824 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
4,626 questions
No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Limitless Technology 37,341 Reputation points

    You can consult the article that talks about "Connect-AzAccount" and the different ways to use it, I believe that what you are looking for is in this article and should help you enough to proceed:


    --If the answer is helpful, please vote positively and accept the answer--

    No comments

  2. Murugesa Pandian 81 Reputation points


    You can switch back and forth by changing the tenant id using Connect-AzAccount -Tenant $tenantid.
    There is no option to log into multiple tenant accounts simultaneously using the above cmdlet.

    No comments