Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
0 like 0 dislike
2.9k views
in Azure by 35 40 48

I got this error "The term 'Connect-AzureAD' is not recognized as the name of a cmdlet" when trying to connect to Azure Active Directory using PowerShell

PS C:\Windows\system32> Connect-AzureAD

but I got this error message

PS C:\Windows\system32> Connect-AzureAD
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.
At line:1 char:1
+ Connect-AzureAD
+ ~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Connect-AzureAD:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

The term 'Connect-AzureAD' is not recognized as the name of a cmdlet


1 Answer

1 like 0 dislike
by 152 169 345
selected by
 
Best answer

Solving: The term 'Connect-AzureAD' is not recognized as the name of a cmdlet

To can connect to Azure Active Directory using PowerShell, you have first to install the AzureAD module by doing the following:

  1. Make sure that the current PowerShell version is 5.0 or later releases to can run the Install-Module cmdlet. otherwise, you will get this error "The term 'Install-Module' is not recognized as the name of a cmdlet".

    To get the current PowerShell version and can run the Install-Module cmdlet, please check The term 'Install-Module' is not recognized

  2. Run the Windows PowerShell as Administrator.
    Run Windows PowerShell as Administrator
  3. Run the below cmdlet to install the Azure AD module

     Install-Module AzureAD
    

    Note: you may get an error "Unable to install multiple modules matched AzureAD" that refers to you have multiple modules with different versions, in this case, you have to specify the required version using -RequiredVersion parameter.

  4. Once the Azure AD module is installed, Try now to run the Connect-AzureAD cmdlet now that should be working as expected!
    how to connect to azure active directory using PowerShell
If you don’t ask, the answer is always NO!
...