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
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.
- Close the Current PowerShell window or session.
- Open PowerShell ISE with Run as Administrator mode.
3. Now try rerunning the command, This time you won’t get any issues. Check out the below screenshot.
Voila !!! this is the way you can fix the error “Administrator rights are required to install modules“. Thanks for reading this article !!!
I am Rajkishore, and I have over 14 years of experience in Microsoft Azure and AWS, with good experience in Azure Functions, Storage, Virtual Machine, Logic Apps, PowerShell Commands, CLI Commands, Machine Learning, AI, Azure Cognitive Services, DevOps, etc. Not only that, I do have good real-time experience in designing and developing cloud-native data integrations on Azure or AWS, etc. I hope you will learn from these practical Azure tutorials. Read more.