Unable to execute Get-AzureADMSPrivilegedRoleAssignment in powershell its giving me an error as
Get-AzureADMSPrivilegedRoleAssignment : The term 'Get-AzureADMSPrivilegedRoleAssignment' is not recognized
I tried installing AzureADPreview module, it says the module already present, but still am getting this error.
Get-AzureADMSPrivilegedRoleAssignment : The term 'Get-AzureADMSPrivilegedRoleAssignment' is not recognized as the name
of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,
verify that the path is correct and try again.
At line:1 char:1
+ Get-AzureADMSPrivilegedRoleAssignment
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-AzureADMSPrivilegedRoleAssignment:String) [], CommandNotFoundExcept
ion
+ FullyQualifiedErrorId : CommandNotFoundException
Any suggestion will be helpful.
This error usually occurs when you don't have
AzureADPreviewmodule installed while running that command.I tried to reproduce the same in my environment and got the same error as below:
Response:
To resolve the error, you need to install
AzureADPreviewmodule.If you try to install that module without removing
AzureADmodule, you will get error as below:Response:
To resolve this, close the existing session and open new PowerShell window by running as Administrator.
Make sure to uninstall
AzureADmodule and installAzureADPreviewmodule like below:Response:
After installing
AzureADPreviewmodule, I got the response successfully when I ran below command:Response: