Powershell 7 突然无法使用 connect-AzureAD

huangapple go评论103阅读模式
英文:

Powershell 7 suddenly unable to use connect-AzureAD

问题

我在Powershell7中遇到了一个新的问题,以前从未遇到过。我已经在谷歌上搜索过,但没有看到完全相同的问题。

PS版本为7.3.6

我可以导入模块(import-module AzureAD)
但是当我尝试连接时,立即出现以下错误,没有弹出窗口要求登录并使用多重身份验证:

Connect-AzureAD:此模块不支持PowerShell Core版。请使用PowerShell桌面版(Windows PowerShell)重试操作。

关于我的配置的更多详细信息:

PS C:\Users\Banksy> $PSVersionTable

Name Value


PSVersion 7.3.6
PSEdition Core
GitCommitId 7.3.6
OS Microsoft Windows 10.0.22621
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

是否有办法将PSEdition从Core更改为Desktop,或者这不是问题?我可以使用模块如MicrosoftTeams连接到其他365资源。

提前感谢。

英文:

I have a new issue with Powershell7 that I've not encountered before. I've googled around but not seen the exact same issue.

PS version is 7.3.6

I can import module (import-module AzureAD)
but when I try to connect I get the following error instantly & no pop-up appears to sign-in and use MFA:

> Connect-AzureAD: This module does not support PowerShell Core edition. Retry the operation with PowerShell Desktop edition (Windows PowerShell).

More details on my configuration:

PS C:\Users\Banksy> $PSVersionTable

Name Value


PSVersion 7.3.6
PSEdition Core
GitCommitId 7.3.6
OS Microsoft Windows 10.0.22621
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Is there a way to change the PSEdition from Core to Desktop or is this not the issue? I can use and connect to other 365 resources using modules like; MicrosoftTeams.

Thanks in advance

答案1

得分: 1

错误消息 "Connect-AzureAD: 此模块不支持 PowerShell Core 版本。请使用 PowerShell Desktop 版本 (Windows PowerShell) 重试操作。" 通常是因为 Azure AD 模块不支持 PowerShell Core 而引起的。

参考 @jeff-brown 的这篇 博客,它指出 Microsoft Azure Active Directory 模块不支持 PowerShell Core 或版本 7 及更高版本。

因此,作为一种解决方法,您可以尝试使用 Windows PowerShell 而不是 PowerShell Core,如下所示:

Install-Module -Name AzureAD
Import-Module -Name AzureAD

Connect-AzureAD

Powershell 7 突然无法使用 connect-AzureAD

否则,尝试安装 AzureADPreview 模块:

Install-Module -Name AzureADPreview
Import-Module AzureADPreview -UseWindowsPowerShell

Powershell 7 突然无法使用 connect-AzureAD

参考资料:

Connect-AzureAD not working with Powershell core - Stack Overflow 由 Rahul Mahajan

Connect-AzureAD not working with Powershell 7.1.0-preview.1 由 Aleksandar Nikolić

英文:

The error "Connect-AzureAD: This module does not support PowerShell Core edition. Retry the operation with PowerShell Desktop edition (Windows PowerShell)" usually occurs as Azure AD module is not supported in PowerShell Core.

Refer this blog by @jeff-brown, it states that the Microsoft Azure Active Directory Module is not supported by PowerShell Core or versions 7 and higher.

Hence as a workaround, you can try using Windows PowerShell instead of PowerShell core like below:

Install-Module -Name AzureAD
Import-Module -Name AzureAD

Connect-AzureAD

Powershell 7 突然无法使用 connect-AzureAD

Otherwise, try installing AzureADPreview module:

Install-Module -Name AzureADPreview
Import-Module AzureADPreview -UseWindowsPowerShell

Powershell 7 突然无法使用 connect-AzureAD

References:

Connect-AzureAD not working with Powershell core - Stack Overflow by Rahul Mahajan

Connect-AzureAD not working with Powershell 7.1.0-preview.1 by Aleksandar Nikolić

huangapple
  • 本文由 发表于 2023年7月24日 19:05:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/76753841.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定