Azure Powershell MFA

Handian Sudianto 4,076 Reputation points


After i enable MFA for my account, i'm not able connect to the azure using PowerShell script.

How we can deal with azure PowerShell with MFA enabled?

User's image

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.
5,344 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,299 questions
0 comments No comments
{count} votes

Accepted answer
  1. Harpreet Singh Matharoo 7,396 Reputation points Microsoft Employee

    Hello @Handian Sudianto .

    Thank you for reaching out. I would like to confirm that Connect-AzAccount ideally authenticates user against all the tenants the id is part of. Hence when you enable MFA on the account user is forced to perform Interactive Auth. However, to support this you would need to specifically key-in the tenant id of the organization you want to sign-in to. This has also been documented on the following documentation:

    User's image

    An Interactive Auth example is listed as follows: Connect-AzAccount -TenantId

    I hope this helps and hence would request you to please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    0 comments No comments

0 additional answers

Sort by: Most helpful