Trouble connecting to Azure Active Directory

Raj D 616 Reputation points
2022-05-12T17:35:46.687+00:00

Greetings...

I am trying to authenticate my credentials using Azure Active Directory to write files to Azure File Share from my windows server. I am using the below cmdlet

cmdlet:

Install-Module AzureAD
Import-Module AzureAD
Connect-AzureAD
Get-AzureADUser

Error:

Connect-AzureAD : The term 'Connect-AzureAD' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Not sure what all packages are required and where do I find them.

The below cmdlet shows what I have installed but when I search for the string AzureAD nothing is returned.

(Get-Module -ListAvailable AzureAD*).path 

I tried installing module MSOnline and no luck.

install-module MSOnline

Thank you

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Leila Kong 3,706 Reputation points
    2022-05-25T03:24:50.707+00:00

    Hello @Raj D ,

    Thanks for your query.

    The issue is that Cloud Shell provide a function which overrides the default Connect-AzureAD so that it uses the custom authentication mechanism Cloud Shell uses to avoid you having to re-enter credentials.

    FYI: https://learn.microsoft.com/en-us/answers/questions/788725/39connect-azuread39-is-not-recognized-as-a-name-of.html

    Best regards,
    Leila

    ----------

    If the Answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments

  2. Siva-kumar-selvaraj 15,721 Reputation points
    2022-06-08T23:15:00.467+00:00

    Hi @Raj D ,

    Alternatively, could you please try using Microsoft Graph PowerShell instead to see if you can install and get Azure AD users list? Here is complete list of Azure Graph cmdlets for you reference.

    Steps:

    Install Graph Module
    Authenticate to MS Graph using Connect-MgGraph -Scopes User.ReadWrite.All
    To get user list, use following cmdlet Get-MgUser

    Hope this helps.

    0 comments No comments

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.