0

I've tried everything I can think to do. I've tried multiple versions of PowerShell. As you can see, I am running it as an administrator. I've tried forcing it for the local user context. I've tried setting the execution policy. I added an exclusion to Windows Defender Controlled Folder Access.

I also installed the MSI and was able to run Connect-AzAccount and log in, but still could not do anything like Get-AzureADUser (not a recognized module).

Note that I am running Windows 11 but having the same issue on a Windows 10 machine.

enter image description here

THE JOATMON
  • 1,878
  • 9
  • 49
  • 81
  • I think this is the problem of using TLS 1.0 or 1.1. I remember having a similar problem, I had to set TLS specifically to 1.2 before it started to work. `[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12` (see also: https://www.codyhosterman.com/2016/06/force-the-invoke-restmethod-powershell-cmdlet-to-use-tls-1-2/) – LPChip Sep 27 '21 at 15:57
  • 1
    Try using PowerShell 5.1 instead of PowerShell 7.1, what is happening is, it appears you are launching a separate unelevated instance of a PowerShell prompt (unknown based on the details provided why that might be happening). – Ramhound Sep 27 '21 at 15:58
  • What is happening is by installing it the way you are doing, you are starting a separate PowerShell console instance since you are using PowerShellGet to install the module. What are the contents of `C:\Program Files\PackageManagement\ProviderAssemblies` and/or `C:\Users\YourUsernameHere\AppData\Local\PackageManagement\ProviderAssemblies` and does it contain NuGet? As an Administrator within PowerShell 5.1 the command(s) you have issued worked. If your machine is connected to a domain you would have to change the excitation policy through a group policy. – Ramhound Sep 27 '21 at 16:19
  • @LPChip: That didn't help. Ramhound: Which way am I SUPPOSED to be doing it? How am I supposed to install AzureAD Module in Powershell 7.1? – THE JOATMON Sep 27 '21 at 17:29
  • @JOATMON Run `$PSVersionTable.PSVersion` and what version of PS does it say you're running. I assume you right clicked and select 'run as administrator' too, right. I know you say you can see "Administrator" in the title of the command window, but that does not necessarily mean you actually right clicked and selected run as administrator (or another user and typed in an admin credential), or you're logged on as admin and that's what will show whether or not admin elevated running the PowerShell 7 executable file. Wanted to throw out the obvious just in case it's being overanalyzed. – Vomit IT - Chunky Mess Style Sep 28 '21 at 02:59

0 Answers0