Azure Powershell MFA

Handian Sudianto 6,096 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 for business Windows Server User experience PowerShell
Microsoft Security Microsoft Entra Microsoft Entra ID
0 comments No comments
{count} votes

Accepted answer
  1. Harpreet Singh Matharoo 8,396 Reputation points Microsoft Employee Moderator
    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

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.