执行Get-AzureADMSPrivilegedRoleAssignment命令遇未识别错误求助
解决Get-AzureADMSPrivilegedRoleAssignment命令未找到问题
问题重现
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
解决步骤
强制加载AzureADPreview模块:即使模块已安装,PowerShell可能未自动加载,执行以下命令
Import-Module AzureADPreview -Force加载后用
Get-Command Get-AzureADMSPrivilegedRoleAssignment确认命令是否存在检查并更新模块版本:旧版本可能缺少该cmdlet,先卸载所有旧版本再重新安装(需管理员权限)
Uninstall-Module AzureADPreview -AllVersions -Force Install-Module AzureADPreview -Force -AllowClobber排查模块冲突:AzureAD正式版和预览版可能冲突,先卸载正式版
Uninstall-Module AzureAD -AllVersions -Force Import-Module AzureADPreview -Force确认PowerShell环境:确保使用PowerShell 5.1及以上版本,执行
$PSVersionTable.PSVersion查看;同时检查执行策略,若为Restricted则修改为RemoteSignedSet-ExecutionPolicy RemoteSigned -Scope CurrentUser重新登录AzureAD:执行命令前需完成身份验证
Connect-AzureAD
内容的提问来源于stack exchange,提问作者Jim Macaulay
相关产品推荐
相关产品推荐

