powershellazure-ad-b2cazure-powershellpowershell-7.3

Powershell 7 suddenly unable to use connect-AzureAD


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


Solution

  • 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
    

    enter image description here

    Otherwise, try installing AzureADPreview module:

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

    enter image description here

    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ć