[英]move bulk users upload from local db to azure b2c active directory in JAVA
I am trying to make a console app in java through which I want to migrate more than 100000 users to Azure AD B2C.我正在尝试在 java 中制作一个控制台应用程序,我想通过它将超过 100000 个用户迁移到 Azure AD B2C。
We are using Graph API for this purpose.为此,我们使用 Graph API。
I have created a JSON format file which has a list of users, looks like below:我创建了一个包含用户列表的 JSON 格式文件,如下所示:
{
"users": [
{
"displayName": "Amanda Polly",
"givenName": "Amanda",
"surname": "Polly",
"extension_user_type": "user",
"identities": [
{
"signInType": "emailAddress",
"issuerAssignedId": "amandapolly@gmail.com"
}
],
"extension_timezone": "PST",
"extension_locale": "en-US",
"extension_tenant": "EG1234"
},
{
"displayName": "Lowa Doe",
"givenName": "Lowa",
"surname": "Doe",
"extension_user_type": "user",
"identities": [
{
"signInType": "userName",
"issuerAssignedId": "lowadow123"
}
],
"extension_timezone": "PST",
"extension_locale": "en-US",
"extension_tenant": "EG1234"
}
]
}
I have this in a (dot)json file, i have to use this file and create users in b2c active directory using graph API, need help in starting.我在 (dot)json 文件中有这个,我必须使用这个文件并使用图 API 在 b2c 活动目录中创建用户,在启动时需要帮助。
User graph api and send a post request, like this用户图 api 并发送一个 post 请求,像这样
Set all the fields and then work it out like this.设置所有字段,然后像这样计算出来。
User createNewUser = new User();
createNewUser.displayName = displayName;
if (givenName.equals(null) || givenName.isEmpty() || givenName.equals("") || givenName.equals(" ")) {
LOG.warn("givenName is empty");
} else {
createNewUser.givenName = givenName;
}
if (surname.equals(null) || surname.isEmpty() || surname.equals("") || surname.equals(" ")) {
LOG.warn("surname is empty");
} else {
createNewUser.surname = surname;
}
final LinkedList<ObjectIdentity> identitiesList = new LinkedList<ObjectIdentity>();
ObjectIdentity identities = new ObjectIdentity();
identities.signInType = signInType;
identities.issuerAssignedId = issuerAssignedId;
identities.issuer = "controlme.onmicrosoft.com";
identitiesList.add(identities);
createNewUser.identities = identitiesList;
PasswordProfile passwordProfile = new PasswordProfile();
passwordProfile.password = generatePassword(15);
passwordProfile.forceChangePasswordNextSignIn = false;
createNewUser.passwordProfile = passwordProfile;
createNewUser.passwordPolicies = "DisablePasswordExpiration";
User buildUserRequest = graphClient.users()
.buildRequest()
.post(createNewUser);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.