Azure Powershell MFA

Handian Sudianto 4,076 Reputation points
2023-09-05T01:42:34.1833333+00:00

Hello,

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
    2023-09-05T10:16:52.2033333+00:00

    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: https://learn.microsoft.com/en-us/powershell/module/az.accounts/connect-azaccount?view=azps-10.2.0

    User's image

    An Interactive Auth example is listed as follows: Connect-AzAccount -TenantId contoso.onmicrosoft.com

    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