Quite often the basic logic of how to connect to Azure Active Directory with PowerShell is omitted in so many of these how to guides and for this reason I’ve added the references below. If for no other reason than to allow me to refer back to in the future.
Below is Microsoft’s documentation on Azure Active Directory PowerShell 2.0;
https://docs.microsoft.com/en-us/powershell/azure/active-directory/install-adv2?view=azureadps-2.0
If your machine meets the prerequisites, the following command will install the General Availability version of the module on your computer
Install-Module AzureAD
Prior to any cmdlets being run, the Connect-AzureAD command should be run in PowerShell. Running this command will prompt for credentials which can be pre-empted using the $AzureAdCred = Get-Credential command.
$AzureAdCred = Get-Credential
Connect-AzureAD -Credential $AzureAdCred
Once complete, you’ll be connected to AzureAD and able to run further commands found here https://docs.microsoft.com/en-us/powershell/module/azuread/?view=azureadps-2.0#azuread