azure - 如何以编程方式将 Azure AD 用户添加到 Azure DevOps 组织

标签 azure azure-devops azure-active-directory azure-ad-graph-api azure-devops-rest-api

我的组织已连接到 Azure AD。

我想使用 C# 或通过 Microsoft REST/Graph API 将 AD 用户添加到我的 Azure DevOps 组织。

Adding user to organisation

最佳答案

您可以使用User Entitlements - Add来做到这一点休息API:

POST https://vsaex.dev.azure.com/{organization}/_apis/userentitlements?api-version=5.1-preview.2

json 正文示例:

{
  "accessLevel": {
    "accountLicenseType": "express"
  },
  "extensions": [
    {
      "id": "ms.feed"
    }
  ],
  "user": {
    "principalName": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a1cfc4d6d4d2c4d3e1c7c0c3d3c8cac0cc8fc2cecc" rel="noreferrer noopener nofollow">[email protected]</a>",
    "subjectKind": "user"
  },
  "projectEntitlements": [
    {
      "group": {
        "groupType": "projectContributor"
      },
      "projectRef": {
        "id": "e5943a98-a842-4001-bd3b-06e756a7dfac"
      }
    }
  ]
}

关于azure - 如何以编程方式将 Azure AD 用户添加到 Azure DevOps 组织,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58709818/

相关文章:

c# - .NET Core 2.1.5 HTTP 错误 502.5 - 部署过程失败

azure - 包版本太长

具有托管标识(用户分配)的 Azure SQL 无法针对 AAD 使用

python - 下载 Python 中的 Azure Devops Artifact

Azure Devops Pipeline 构建失败 无法解析此引用 无法找到程序集

azure-active-directory - Azure AD (Active Directory) 中的 Multi-Tenancy 应用因 AADSTS50020 而失败

Azure AD B2C 自定义策略登录错误 : AADB2C: Encryption key must be a 256-bit key

azure - Microsoft Graph OData 查询参数 $expand 似乎不起作用

azure - 出现异常 - "The property value is larger than allowed by the Table Service",azure存储表中行的最大大小是多少

c# - Microsoft Azure Web App - ASP.NET 无权访问请求的资源