PowerShell Azure AD

chris_nawig 41 Reputation points

Hi guys,

How to query Azure AD?

If I have my Windows or Mac device, how do i set the credentials to start querying AD?

If I will use Python and PowerShell, how do i set the authentication?

Thanks for any help.

Azure Active Directory
Azure Active Directory
An Azure enterprise identity service that provides single sign-on and multi-factor authentication.
13,560 questions
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. AmanpreetSingh-MSFT 55,411 Reputation points

    Hi @chris_nawig · Thank you for reaching out.

    To connect to Azure AD via PowerShell, you need to run Connect-AzureAD cmdlet after installing Azure AD PowerShell Module.

    To store the credentials in variable, you can run:

    $Credential = Get-Credential  
    Connect-AzureAD -Credential $Credential  

    Note: If you are storing credentials in variable, MFA must be disabled for the user account.

    For Python, you can refer to this code sample.


    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    2 people found this answer helpful.
    No comments