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


Error:

PS C:\Users> 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) [], CommandNotFoundExcep
   tion
    + FullyQualifiedErrorId : CommandNotFoundException

Screenshot:

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

Reason for the Error:

    The reason for this error is that you do not have the AzureAD Module installed on your device, you will need to download and install it.


Fix:

    Install-Module -Name AzureAD
    

    Type why when prompted.

    Untrusted repository
    
    You are installing the modules from an untrusted repository. 
    If you trust this repository, change its InstallationPolicy value 
    by running the Set-PSRepository cmdlet. 
    
    Are you sure you want to install the modules from 'PSGallery'? 
    [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): Y

    Next we import the module into our current session.

    Import-Module AzureAD
    

    You should now be good to use the Connect-AzureAD cmdlet.

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap