I am trying to do some Azure scripting with PowerShell. To do that I need to install the Microsoft.Graph
module.
To do that I run the following command:
Install-Module Microsoft.Graph -Scope CurrentUser
After selecting "Y" to continue, it hangs for about 5 seconds. Then it seems to be doing the install. (I see a couple of progress bars.) Then they are replaced with an error that says I need admin rights. Here is a screenshot:
But I am an Admin, and I am running powershell in Admin mode.
I ran the following command that (supposedly) shows if you are an admin or not, and it returned true
:
How can I figure out what is causing this error?
Need to check below:
Check that the PowerShellGet
and PackageManagement
modules are up to date.
If you are using a proxy, the module installation may be restricted. Check that your proxy settings in PowerShell are accurate.
Try to use -Force parameter with the Install-Module
command to avoid conflicts. It will work in some cases.
Certain antivirus or firewall
software may interfere with PowerShell module installation in some instances. Disabling them for the duration of the installation could help in determining the issue.
You may also use the Get-ExecutionPolicy -List
command to see if there are any extra sources that are blocking the installation of PowerShell modules even if you are running in administrator mode.
After checked all the above, I tried to install Microsoft.Graph
extension in my environment and it worked as expected.
Install-Module Microsoft.Graph -Scope CurrentUser