Administrator rights are required to install modules

One important thing to note here is you cannot install PowerShell modules by using install-module directly in the case of Azure PowerShell functions. Meaning if you try installing any other modules that are not part of the default modules, then it will not allow you to install the modules, it will show you the error message ” Administrator rights are required to install modules “.

Below is the exact error message that I got

install-module: Administrator rights are required to install modules in ‘C:\Program Files\WindowsPowerShell\Modules’. Log on to the
computer with an account that has Administrator rights, and then try again, or install
‘C:\Users\Bijay\Documents\WindowsPowerShell\Modules’ by adding “-Scope CurrentUser” to your command. You can also try running the Windows
PowerShell session with elevated rights (Run as Administrator).
At line:1 char:1

  • install-module azurerm
  • ~~~~~~
    • CategoryInfo : InvalidArgument: (:) [Install-Module], ArgumentException
    • FullyQualifiedErrorId: InstallModuleNeedsCurrentUserScopeParameterForNonAdminUser, Install-Module

You can see it here

Administrator rights are required to install modules

Since the install-module points to the PowerShell environment directory directly and we don’t have access to that we are getting this error message ” Administrator rights are required to install modules ”.

Administrator rights are required to install modules [Solved]

Follow the below steps to solve this error.

  1. Close the Current PowerShell window or session.
  2. Open PowerShell ISE with Run as Administrator mode.
install-module : Administrator rights are required to install modules

3. Now try rerunning the command, This time you won’t get any issues. Check out the below screenshot.

install-module

Voila !!! this is the way you can fix the error “Administrator rights are required to install modules“. Thanks for reading this article !!!