gpt4 book ai didi

azure - 如何从管道获取 Azure Active Directory 用户详细信息?

转载 作者:行者123 更新时间:2023-12-03 02:45:53 25 4
gpt4 key购买 nike

我需要使用 Power shell 在 Azure 中创建 key 保管库。此 PS 脚本从管道运行。

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

我使用上面的命令来获取用户 ID,但出现错误

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

最佳答案

是的,绝对是的,您必须向管道正在运行的用户提供权限。用户应该拥有 Directory.RaadAll、读取所有用户基本个人资料权限才能阅读其个人资料。

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

您可以引用此链接创建应用身份(服务主体)

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

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

enter image description here :

检查此以供进一步引用:

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

希望有帮助。

关于azure - 如何从管道获取 Azure Active Directory 用户详细信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58912738/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com