使用 Azure 逻辑应用将 Azure AD 用户添加到 Azure DevOps 项目组
Add an Azure AD user to a Azure DevOps project group using Azure Logic Apps
我正在尝试使用 Azure Logic Apps DevOps 连接器将 Azure AD 用户添加到 Azure DevOps 项目组,操作 向 Azure DevOps 发送 HTTP 请求 但我收到状态未授权 而对于同一个用户,我可以在门户中手动完成。因为几乎没有关于此工具及其使用的 API 的文档,所以我猜它与 URI 有关但不确定。有什么想法吗?
谢谢
我们无法通过 Azure 逻辑应用将 Azure AD 用户添加到 Azure DevOps 项目组。这是操作 向 Azure DevOps 发送 HTTP 请求
中的一个已知问题
我们正在使用此 REST API 到 add an AAD user as member of a group, it need the permission scope vso.graph_manage
并且根据此 doc 操作向 Azure DevOps 发送 HTTP 请求具有一组有限的范围,这些范围控制操作可以访问哪些资源以及允许操作对这些资源执行哪些操作.
范围包含:
- vso.agentpools_manage
- vso.build_execute
- vso.chat_manage
- vso.code_manage
- vso.code_status
- vso.connected_server
- vso.dashboards_manage
- vso.entitlements
- vso.extension.data_write
- vso.extension_manage
- vso.identity
- vso.loadtest_write
- vso.packaging_manage
- vso.project_manage
- vso.release_manage
- vso.test_write
- vso.work_write
因为它不包含范围vso.graph_manage
,我们可以在输出内容
中看到错误信息:TF400813: The user xxx is not authorized to access this resource
更新1
电源shell脚本:
$connectionToken="{PAT}"
$base64AuthInfo= [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($connectionToken)"))
$URL = "https://vssps.dev.azure.com/{Org name}/_apis/graph/users?groupDescriptors={groupDescriptors}&api-version=6.0-preview.1"
$body =@"
{
"principalName": "{User email}"
}
"@
$Result = Invoke-RestMethod -Uri $URL -ContentType "application/json" -Body $body -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -Method POST
我正在尝试使用 Azure Logic Apps DevOps 连接器将 Azure AD 用户添加到 Azure DevOps 项目组,操作 向 Azure DevOps 发送 HTTP 请求 但我收到状态未授权 而对于同一个用户,我可以在门户中手动完成。因为几乎没有关于此工具及其使用的 API 的文档,所以我猜它与 URI 有关但不确定。有什么想法吗?
谢谢
我们无法通过 Azure 逻辑应用将 Azure AD 用户添加到 Azure DevOps 项目组。这是操作 向 Azure DevOps 发送 HTTP 请求
中的一个已知问题我们正在使用此 REST API 到 add an AAD user as member of a group, it need the permission scope vso.graph_manage
并且根据此 doc 操作向 Azure DevOps 发送 HTTP 请求具有一组有限的范围,这些范围控制操作可以访问哪些资源以及允许操作对这些资源执行哪些操作.
范围包含:
- vso.agentpools_manage
- vso.build_execute
- vso.chat_manage
- vso.code_manage
- vso.code_status
- vso.connected_server
- vso.dashboards_manage
- vso.entitlements
- vso.extension.data_write
- vso.extension_manage
- vso.identity
- vso.loadtest_write
- vso.packaging_manage
- vso.project_manage
- vso.release_manage
- vso.test_write
- vso.work_write
因为它不包含范围vso.graph_manage
,我们可以在输出内容
TF400813: The user xxx is not authorized to access this resource
更新1
电源shell脚本:
$connectionToken="{PAT}"
$base64AuthInfo= [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($connectionToken)"))
$URL = "https://vssps.dev.azure.com/{Org name}/_apis/graph/users?groupDescriptors={groupDescriptors}&api-version=6.0-preview.1"
$body =@"
{
"principalName": "{User email}"
}
"@
$Result = Invoke-RestMethod -Uri $URL -ContentType "application/json" -Body $body -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -Method POST