I can connect to AzureAD using the following command just fine and run queries against AD
Connect-AzureAD -Confirm
However when i attempt to user the Get-Credential and store it as a variable, it does not seem to work, not sure why i am getting the Unsupported User Type 'Unkown'
> $Credential = Get-Credential
cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Credential
> Connect-AzureAD -Credential $Credential
WARNING: Install the latest PowerShell module, the Microsoft Graph PowerShell SDK, for new features and improvements!
https://aka.ms/graphPSmigration
Connect-AzureAD : One or more errors occurred.
At line:1 char:1
+ Connect-AzureAD -Credential $Credential
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : AuthenticationError: (:) [Connect-AzureAD], AggregateException
+ FullyQualifiedErrorId : Connect-AzureAD,Microsoft.Open.Azure.AD.CommonLibrary.ConnectAzureAD
Connect-AzureAD : Unsupported User Type 'Unknown'. Please see https://aka.ms/msal-net-up.
At line:1 char:1
+ Connect-AzureAD -Credential $Credential
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : AuthenticationError: (:) [Connect-AzureAD], MsalClientException
+ FullyQualifiedErrorId : Connect-AzureAD,Microsoft.Open.Azure.AD.CommonLibrary.ConnectAzureAD
Connect-AzureAD : One or more errors occurred.
At line:1 char:1
+ Connect-AzureAD -Credential $Credential
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Connect-AzureAD], AggregateException
+ FullyQualifiedErrorId : System.AggregateException,Microsoft.Open.Azure.AD.CommonLibrary.ConnectAzureAD
I know my creds are right when storing them as the variable, not sure why i get an error when using this method.

Thanks to
jdwengfor suggesting the same point.The above error is encountered when you are passing local
VMcredentials for connecting toAzure AD. Azure AD requires the user UPN and password, as it needs the domain name for connecting toAzure AD.When I pass the correct
Azure AD UPNandpasswordinstead of a local username, it connects toAzure ADand is able to fetch the user details.