

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 使用 AWS 管理控制台、 AWS CLI 和 API 加入 SVMs 活动目录
<a name="join-svm-to-ad"></a>

可以使用以下过程将现有 SVM 加入 Active Directory。在此过程中，SVM 还*没有*加入 Active Directory。

**将 SVM 加入 Active Directory（AWS 管理控制台）**

1. 打开亚马逊 FSx 控制台，网址为[https://console.aws.amazon.com/fsx/](https://console.aws.amazon.com/fsx/)。

1. 选择要加入活动目录的 SVM：
   + 在左侧导航窗格中，选择**文件系统**，然后选择包含要更新的 SVM 的 ONTAP 文件系统。
   + 选择**存储虚拟机**选项卡。

     –或–
   + 要显示所有可用虚拟机的列表 SVMs，请在左侧导航窗格中展开 **ONTAP**，然后选择**存储虚拟机**。中将显示您的账户 SVMs 中所有内容 AWS 区域 的列表。

   从列表中选择要加入 Active Directory 的 SVM。

1. 在 SVM **摘要**面板的右上角，选择**操作** > **加入/更新 Active Directory**。此时显示**将 SVM 加入 Active Directory** 窗口。

1. 输入要将 SVM 加入其中的 Active Directory 的以下信息：
   + 为 SVM 创建的 Active Directory 计算机对象的 **NetBIOS 名称**。这是 Active Directory 中 SVM 的名称，其在 Active Directory 中必须唯一。不要使用主域的 NetBIOS 名称。NetBIOS 名称不能超过 15 个字符。
   + Active Directory 域的**完全限定域名（FQDN）**。域名不能超过 255 个字符。
   + **DNS 服务器 IP 地址**-您的域名的 DNS 服务器的 IPv4 或 IPv6 地址。
   + **服务账户凭证**：选择如何提供服务账户凭证：
     + **选项 1**： AWS Secrets Manager 秘密 ARN-包含您的 Active Directory 域上服务帐户的用户名和密码的密钥。有关更多信息，请参阅 [使用存储活动目录凭证 AWS Secrets Manager](self-managed-AD-best-practices.md#bp-store-ad-creds-using-secret-manager)。
     + **选项 2**：纯文本凭证
       + **服务账户用户名**：现有 Microsoft Active Directory 中服务账户的用户名。请勿包含域前缀或后缀。例如，对于 `EXAMPLE\ADMIN`，仅使用 `ADMIN`。
       + **服务账户密码** – 服务账户的密码。
       + **确认密码** – 服务账户的密码。
     + **在 Secrets Manager 中管理**（默认）：提供包含服务账户凭证的 Secrets Manager 密钥的 ARN。密钥必须包含键值对 `CUSTOMER_MANAGED_ACTIVE_DIRECTORY_USERNAME` 和 `CUSTOMER_MANAGED_ACTIVE_DIRECTORY_PASSWORD`。
     + （可选）**组织单元（OU）**：要将 SVM 加入到的组织单元的可分辨路径名称。
     + **委托文件系统管理员组** – Active Directory 中可以管理您的文件系统的组的名称。

       如果您正在使用 AWS Managed Microsoft AD，则必须指定一个群组，例如 AWS 委派 FSx管理员、 AWS 授权管理员或具有向 OU 委派权限的自定义群组。

       如果您要加入自行管理的活动目录，请在活动目录中使用该组的名称。默认组为 `Domain Admins`。

1. 选择**加入 Active Directory**，使用您提供的配置将 SVM 加入 Active Directory。

**将 SVM 加入活动目录 (AWS CLI)**
+ 要将 fo FSx r ONTAP SVM 加入活动目录，请使用 CL [update-storage-virtual-machine](https://docs.aws.amazon.com/cli/latest/reference/fsx/update-storage-virtual-machine.html)I 命令（或等效[UpdateStorageVirtualMachine](https://docs.aws.amazon.com/fsx/latest/APIReference/API_UpdateStorageVirtualMachine.html)的 API 操作），如以下示例所示。

  ```
  aws fsx update-storage-virtual-machine \
    --storage-virtual-machine-id svm-abcdef0123456789a\
    --active-directory-configuration SelfManagedActiveDirectoryConfiguration='{DomainName="corp.example.com", \
      OrganizationalUnitDistinguishedName="OU=FileSystems,DC=corp,DC=example,DC=com",\
      FileSystemAdministratorsGroup="FSxAdmins",UserName="FSxService",\
      Password="password", \
      DnsIps=["10.0.1.18"]}',NetBiosName=amznfsx12345
  ```

  成功创建存储虚拟机后，Amazon 以 JSON 格式 FSx 返回其描述，如以下示例所示。

  ```
  {
    "StorageVirtualMachine": {
      "ActiveDirectoryConfiguration": {
        "NetBiosName": "amznfsx12345",
        "SelfManagedActiveDirectoryConfiguration": {
          "UserName": "Admin",
          "DnsIps": [
            "10.0.1.3",
            "10.0.91.97"
          ],
          "OrganizationalUnitDistinguishedName": "OU=Computers,OU=customer-ad,DC=customer-ad,DC=example,DC=com",
          "DomainName": "customer-ad.example.com"
        }
      }
      "CreationTime": 1625066825.306,
      "Endpoints": {
        "Management": {
          "DnsName": "svm-abcdef0123456789a.fs-0123456789abcdef0.fsx.us-east-1.amazonaws.com",
          "IpAddressses": ["198.19.0.4"]    
        },
        "Nfs": {
          "DnsName": "svm-abcdef0123456789a.fs-0123456789abcdef0.fsx.us-east-1.amazonaws.com",
          "IpAddressses": ["198.19.0.4"]    
        },
        "Smb": {
          "DnsName": "amznfsx12345",
          "IpAddressses": ["198.19.0.4"]        
        },
        "SmbWindowsInterVpc": {
          "IpAddressses": ["198.19.0.5", "198.19.0.6"]    
        },
        "Iscsi": {
          "DnsName": "iscsi.svm-abcdef0123456789a.fs-0123456789abcdef0.fsx.us-east-1.amazonaws.com",
          "IpAddressses": ["198.19.0.7", "198.19.0.8"]    
        }
      },
      "FileSystemId": "fs-0123456789abcdef0",
      "Lifecycle": "CREATED",
      "Name": "vol1",
      "ResourceARN": "arn:aws:fsx:us-east-1:123456789012:storage-virtual-machine/fs-0123456789abcdef0/svm-abcdef0123456789a",
      "StorageVirtualMachineId": "svm-abcdef0123456789a",
      "Subtype": "default",
      "Tags": [],
  
    }
  }
  ```