【问题标题】:How to get Azure Active Directory user details from pipeline?如何从管道获取 Azure Active Directory 用户详细信息?
【发布时间】:2020-03-13 17:09:32
【问题描述】:

我需要使用电源外壳在 Azure 中创建密钥保管库。此 PS 脚本从管道运行。

$UserObjectId = (Get-AzureRmADUser -SearchString xxxxxxxxxx).Id

我使用上面的命令来获取用户ID,但我得到的错误是

“权限不足,无法完成此操作”。我是否需要向执行管道的用户授予任何权限?

【问题讨论】:

    标签: azure azure-devops azure-pipelines azure-powershell


    【解决方案1】:

    是的,您必须向正在运行的管道下的用户提供权限。用户应具有 Directory.RaadAll,读取所有用户基本配置文件权限,以阅读他们的配置文件。

    但理想情况下,您应该使用服务主体运行您的 Azure Devops 管道,并且您应该为您的应用程序提供权限。

    您可以参考此链接来创建应用程序身份(服务主体)

    https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal

    然后您可以登录 Azure 门户并浏览应用程序并提供 Windows Azure 目录下的权限,如下所示:

    :

    检查此以供进一步参考:

    https://blog.hqcodeshop.fi/archives/435-Setting-up-Azure-AD-Application-from-Azure-DevOps-pipeline-Powershell-task,-Part-2-of-2-The-scripts.html

    希望对你有帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-01-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-12
      相关资源
      最近更新 更多