You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

执行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则修改为RemoteSigned

    Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
    
  • 重新登录AzureAD:执行命令前需完成身份验证

    Connect-AzureAD
    

内容的提问来源于stack exchange,提问作者Jim Macaulay

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.18 10:30:53