Arn*_*arg 2 createuser azure-ad-graph-api azure-ad-b2c
我正在尝试用 C# 制作一个控制台应用程序,希望通过它将超过 100000 个用户迁移到 Azure AD B2C。
为此,我们使用 Graph API。
我当前的方法为每个 API 调用创建一个用户帐户,并且需要超过 12 个小时才能迁移大约 50000 个用户。
为了减少总时间,我想批量发送数据,而不是使用 API 逐一发送数据。但是,我无法找到任何解决方案。
是否有可用于批量创建用户的API端点。请帮忙。
另外,如果我想批量删除这些用户。可以这样做吗?
以下是我用于实现解决方案的一些 Microsoft 文档参考。
https://learn.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-user-migration?tabs=applications https://learn.microsoft.com/en-us/previous -versions/azure/ad/graph/api/users-operations#CreateLocalAccountUser
您可以使用JSON 批处理将多个请求合并到一个 HTTP 调用中。
这是一个例子:
POST https://graph.microsoft.com/v1.0/$batch
{
"requests": [{
"id": "1",
"method": "POST",
"url": "/users",
"body": {
"accountEnabled": true,
"displayName": "allentest01",
"mailNickname": "allentest01",
"userPrincipalName": "allentest01@{tenant}.onmicrosoft.com",
"passwordProfile": {
"forceChangePasswordNextSignIn": true,
"password": "{password-value}"
}
},
"headers": {
"Content-Type": "application/json"
}
}, {
"id": "2",
"method": "POST",
"url": "/users",
"body": {
"accountEnabled": true,
"displayName": "allentest02",
"mailNickname": "allentest02",
"userPrincipalName": "allentest02@{tenant}.onmicrosoft.com",
"passwordProfile": {
"forceChangePasswordNextSignIn": true,
"password": "{password-value}"
}
},
"headers": {
"Content-Type": "application/json"
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
您还可以用它删除用户。(使用DELETE方法)
| 归档时间: |
|
| 查看次数: |
3117 次 |
| 最近记录: |