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

Muhammad Suhail Asrulsani 1 Reputation point
2021-11-15T15:24:23.47+00:00

Hi

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
    2021-12-16T18:23:27.617+00:00

    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:

    https://learn.microsoft.com/en-us/powershell/module/az.accounts/connect-azaccount?view=azps-6.6.0

    ----

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

    No comments

  2. Murugesa Pandian 81 Reputation points
    2021-12-19T04:09:27.407+00:00

    Hi,

    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