在 Azure Active Directory 中批量还原已删除的用户Bulk restore deleted users in Azure Active Directory

Azure Active Directory (Azure AD) 支持批量用户还原操作,并支持下载用户、组和组成员的列表。Azure Active Directory (Azure AD) supports bulk user restore operations and supports downloading lists of users, groups, and group members.

了解 CSV 模板Understand the CSV template

下载并填写 CSV 模板,该模板可帮助你成功批量还原 Azure AD 用户。Download and fill in the CSV template to help you successfully restore Azure AD users in bulk. 下载的 CSV 模板可能如下例所示:The CSV template you download might look like this example:

用于上传和调出的电子表格,说明了每一行和每一列的用途和值

CSV 模板结构CSV template structure

下载的 CSV 模板中的行如下所示:The rows in a downloaded CSV template are as follows:

  • 版本号 :包含版本号的第一行必须包含在上传 CSV 中。Version number : The first row containing the version number must be included in the upload CSV.
  • 列标题 :列标题的格式为:<项名称> [PropertyName] <必需或空白>。Column headings : The format of the column headings is <Item name> [PropertyName] <Required or blank>. 例如,Object ID [objectId] RequiredFor example, Object ID [objectId] Required. 某些较旧版本的模板可能会略有不同。Some older versions of the template might have slight variations.
  • 示例行 :我们已经在模板中包含了一行示例,展示了每个列的可接受值。Examples row : We have included in the template a row of examples of acceptable values for each column. 你必须删除示例行并将其替换为你自己的项。You must remove the examples row and replace it with your own entries.

其他指南Additional guidance

  • 不得删除或修改上传模板的前两行,否则无法处理上传。The first two rows of the upload template must not be removed or modified, or the upload can't be processed.
  • 所需的列会先列出。The required columns are listed first.
  • 建议不要将新列添加到模板。We don't recommend adding new columns to the template. 所添加的任何其他列都会被忽略,不进行处理。Any additional columns you add are ignored and not processed.
  • 建议尽可能频繁地下载 CSV 模板的最新版本。We recommend that you download the latest version of the CSV template as often as possible.

如果要批量还原用户,请执行以下操作To bulk restore users

  1. 使用 Azure AD 组织中的用户管理员的帐户登录到 Azure AD 组织Sign in to your Azure AD organization with an account that is a User administrator in the Azure AD organization.

  2. 在 Azure AD 中,选择“用户” > “已删除” 。In Azure AD, select Users > Deleted.

  3. 在“删除用户”页上,选择“批量还原”以上传要还原的用户属性的有效 CSV 文件 。On the Deleted users page, select Bulk restore to upload a valid CSV file of properties of the users to restore.

    在“已删除用户”页上选择“批量还原”命令

  4. 打开 CSV 模板,并为每个要还原的用户添加一行。Open the CSV template and add a line for each user you want to restore. 唯一需要的值为 ObjectID。The only required value is ObjectID. 然后保存文件。Then save the file.

    选择要在其中列出你要添加的用户的本地 CSV 文件

  5. 在“批量还原”页上,在“上传 csv 文件”下,浏览到该文件 。On the Bulk restore page, under Upload your csv file , browse to the file. 选择该文件并单击“提交”后,将启动对 CSV 文件的验证。When you select the file and click Submit , validation of the CSV file starts.

  6. 验证文件内容后,会看到“文件上传成功”消息。When the file contents are validated, you’ll see File uploaded successfully. 如果有错误,必须修正错误,然后才能提交作业。If there are errors, you must fix them before you can submit the job.

  7. 文件通过验证后,请选择“提交”,以启动用于还原用户的 Azure 批量操作。When your file passes validation, select Submit to start the Azure bulk operation that restores the users.

  8. 还原操作完成后,会显示一条通知,指出批量操作成功。When the restore operation completes, you'll see a notification that the bulk operation succeeded.

如果有错误,可以在“批量操作结果”页下载并查看结果文件。If there are errors, you can download and view the results file on the Bulk operation results page. 该文件包含每个错误的原因。The file contains the reason for each error.

查看状态Check status

可在“批量操作结果”页面中查看所有挂起的批量请求的状态。You can see the status of all of your pending bulk requests in the Bulk operation results page.

在“批量操作结果”页面中查看状态。Check status in the Bulk Operations Results page.

接下来,可在 Azure 门户中或使用 PowerShell 查看已还原的用户是否存在于 Azure AD 组织中。Next, you can check to see that the users you restored exist in the Azure AD organization either in the Azure portal or by using PowerShell.

在 Azure 门户中查看已还原用户View restored users in the Azure portal

  1. 使用组织中的用户管理员的帐户登录到 Azure AD 管理中心Sign in to the Azure AD admin center with an account that is a User administrator in the organization.
  2. 在导航窗格中选择“Azure Active Directory”。In the navigation pane, select Azure Active Directory.
  3. 在“管理”下,选择“用户” 。Under Manage , select Users.
  4. 在“显示”下选择“所有用户”,并验证还原的用户是否已列出 。Under Show , select All users and verify that the users you restored are listed.

使用 PowerShell 查看用户View users with PowerShell

运行以下命令:Run the following command:

Get-AzureADUser -Filter "UserType eq 'Member'"

应会看到已还原的用户已列出。You should see that the users that you restored are listed.

后续步骤Next steps