尝试使用 PowerShell 连接到 AzureAD,但获取未知凭据

问题描述 投票:0回答:1

我可以使用以下命令连接到 AzureAD 并针对 AD 运行查询

Connect-AzureAD -Confirm

但是,当我尝试使用 Get-Credential 并将其存储为变量时,它似乎不起作用,不知道为什么我收到不支持的用户类型“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

我知道我的信用在将它们存储为变量时是正确的,不知道为什么在使用此方法时会出现错误。

powershell azure-active-directory azure-powershell powershell-az-module
1个回答
0
投票

尝试使用 PowerShell 连接到 AzureAD,但凭据未知。

感谢

jdweng
提出同样的观点。

当您传递本地

VM
凭据以连接到
Azure AD
时,会遇到上述错误。 Azure AD 需要用户 UPN密码,因为它需要域名才能连接到
Azure AD

enter image description here

当我传递正确的

Azure AD UPN
password
而不是本地用户名时,它会连接到
Azure AD
并能够获取用户详细信息。

    Install-Module AzureAD
    $Credential = Get-Credential
    Connect-AzureAD -Credential $Credential
    Get-AzureADUser -Top 10

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.