我正在尝试将用户迁移到 Azure B2C Active Directory。
早些时候,我正在创建从 JSON 文件中读取并创建它们的“用户”,但是如果 JSON 中的任何“用户”已经存在于 Azure B2C AD 中,我就会遇到异常......
SEVERE: Throwable detail: com.microsoft.graph.http.GraphServiceException: Error code: Request_BadRequest
Error message: Another object with the same value for property userPrincipalName already exists.
我通过简单的 try/catch 处理所有这些“用户”,然后跳过它们并将它们移动到 JSON 中的下一个用户。
现在我需要删除进程中的现有用户(一旦出现上述异常,我将删除该用户)
我试过这个...
private void deleteExistingUser(String issuerAssignedId, IGraphServiceClient graphClient) {
graphClient.users(issuerAssignedId).buildRequest().delete();
LOG.info("User deleted.");
}
但是当上面的代码被击中时,我遇到了异常......
Error message: Resource 'shumi' does not exist or one of its queried reference-property objects are not present.
我相信这是因为我使用 userPrincipalName (issuerAssignedId) 来删除用户,而不是我应该使用“azure returned user id 来删除用户。
有没有办法让我获得 azure retured 用户 ID 或其他方式来删除用户?