

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 管理 SVM Active Directory 組態
<a name="manage-svm-ad-config"></a>

本節說明如何使用 AWS 管理主控台、 AWS CLI、FSx API 和 ONTAP CLI 來執行下列動作：
+ 將現有的 SVM 加入 Active Directory
+ 修改現有的 SVM Active Directory 組態
+ 從 Active Directory SVMs 

若要從 Active Directory 移除 SVM，您必須使用 NetApp ONTAP CLI。

**Topics**
+ [

# 使用 AWS 管理主控台 AWS CLI 和 API 將 SVMs 加入 Active Directory
](join-svm-to-ad.md)
+ [

# 使用 AWS 管理主控台 AWS CLI、 和 API 更新現有的 SVM Active Directory 組態
](update-svm-ad-config.md)
+ [

# 使用 NetApp CLI 更新 SVM Active Directory 組態
](manage-svm-ad-config-ontap-cli.md)

# 使用 AWS 管理主控台 AWS CLI 和 API 將 SVMs 加入 Active Directory
<a name="join-svm-to-ad"></a>

使用下列程序將現有的 SVM 加入 Active Directory。在此程序中，SVM *尚未*加入 Active Directory。

**將 SVM 加入 Active Directory (AWS 管理主控台)**

1. 在 [https://console.aws.amazon.com/fsx/](https://console.aws.amazon.com/fsx/)：// 開啟 Amazon FSx 主控台。

1. 選擇您要加入 Active Directory 的 SVM：
   + 在左側導覽窗格中，選擇**檔案系統**，然後選擇具有您要更新之 SVM 的 ONTAP 檔案系統。
   + 選擇**儲存虛擬機器**索引標籤。

     –或–
   + 若要顯示所有可用 SVMs的清單，請在左側導覽窗格中展開 **ONTAP**，然後選擇**儲存虛擬機器**。 AWS 區域 隨即顯示 中您帳戶中所有 SVMs 的清單。

   從清單中選擇您要加入 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 網域上服務帳戶的使用者名稱和密碼的秘密。如需詳細資訊，請參閱[使用 存放 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 AWS Managed Microsoft AD，則必須指定群組，例如委派 FSx 管理員、 AWS 委派管理員，或具有委派 OU 許可的自訂群組。

       如果您要加入自我管理的 Active Directory，請使用 Active Directory 中的 群組名稱。預設群組為 `Domain Admins`。

1. 選擇**加入 Active Directory**，使用您提供的組態將 SVM 加入 Active Directory。

**將 SVM 加入 Active Directory (AWS CLI)**
+ 若要將 FSx for ONTAP SVM 加入 Active Directory，請使用 [update-storage-virtual-machine](https://docs.aws.amazon.com/cli/latest/reference/fsx/update-storage-virtual-machine.html) CLI 命令 （或同等的 [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 FSx 會以 JSON 格式傳回其描述，如下列範例所示。

  ```
  {
    "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": [],
  
    }
  }
  ```

# 使用 AWS 管理主控台 AWS CLI、 和 API 更新現有的 SVM Active Directory 組態
<a name="update-svm-ad-config"></a>

使用下列程序更新已加入 Active Directory 之 SVM 的 Active Directory 組態。

**更新 SVM Active Directory 組態 (AWS 管理主控台)**

1. 開啟位於 https：//[https://console.aws.amazon.com/fsx/](https://console.aws.amazon.com/fsx/) 的 Amazon FSx 主控台。

1. 選擇要更新的 SVM，如下所示：
   + 在左側導覽窗格中，選擇**檔案系統**，然後選擇具有您要更新之 SVM 的 ONTAP 檔案系統。
   + 選擇**儲存虛擬機器**索引標籤。

     –或–
   + 若要顯示所有可用 SVMs的清單，請在左側導覽窗格中展開 **ONTAP**，然後選擇**儲存虛擬機器**。

   從清單中選擇您要更新的 SVM。

1. 在 SVM **摘要**面板上，選擇**動作** > **加入/更新 Active Directory**。**更新 SVM Active Directory 組態**視窗隨即出現。

1. 您可以在此視窗中更新下列 Active Directory 組態屬性。
   + **DNS 伺服器 IP 地址** – 網域 DNS 伺服器的 IPv4 或 IPv6 地址。
   + **服務帳戶登入**資料 – 選擇如何提供服務帳戶登入資料：
     + **選項 1**： AWS Secrets Manager 秘密 ARN - 包含 Active Directory 網域上服務帳戶的使用者名稱和密碼的秘密。如需詳細資訊，請參閱[使用 存放 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`。
       + **服務帳戶密碼** – 服務帳戶的密碼。
       + **確認密碼** – 服務帳戶的密碼。

1. 輸入更新之後，請選擇**更新 Active Directory** 以進行變更。

使用下列程序來更新已加入 Active Directory 之 SVM 的 Active Directory 組態。

**更新 SVM Active Directory 組態 (AWS CLI)**
+ 若要使用 AWS CLI 或 API 更新 SVM 的 Active Directory 組態，請使用 [update-storage-virtual-machine](https://docs.aws.amazon.com/cli/latest/reference/fsx/update-storage-virtual-machine.html) CLI 命令 （或同等的 [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='{UserName="FSxService",\
      Password="password", \
      DnsIps=["10.0.1.18"]}'
  ```

# 使用 NetApp CLI 更新 SVM Active Directory 組態
<a name="manage-svm-ad-config-ontap-cli"></a>

您可以使用 NetApp ONTAP CLI 將 SVM 加入和退出 Active Directory，以及修改現有的 SVM Active Directory 組態。

## 使用 ONTAP CLI 將 SVM 加入 Active Directory
<a name="using-ontap-cli-to-connect-to-ad"></a>

您可以使用 ONTAP CLI 將現有的 SVMs 加入 Active Directory，如下列程序所述。即使您的 SVM 已加入 Active Directory，您也可以執行此操作。

1. 若要存取 ONTAP CLI，請執行下列命令，在 Amazon FSx for NetApp ONTAP 檔案系統或 SVM 的管理連接埠上建立 SSH 工作階段。`management_endpoint_ip` 將 取代為檔案系統管理連接埠的 IP 地址。

   ```
   [~]$ ssh fsxadmin@management_endpoint_ip
   ```

   如需詳細資訊，請參閱[使用 CLI ONTAP 管理檔案系統](managing-resources-ontap-apps.md#fsxadmin-ontap-cli)。

1.  透過提供完整目錄 DNS 名稱 (`corp.example.com`) 和至少一個 DNS 伺服器 IP 地址，為您的 Active Directory 建立 DNS 項目。

   ```
   ::>vserver services name-service dns create -vserver svm_name -domains corp.example.com -name-servers dns_ip_1, dns_ip_2 
   ```

   若要驗證與 DNS 伺服器的連線，請執行下列命令。將 *svm\$1name* 取代為您自己的資訊。

   ```
   FsxId0ae30e5b7f1a50b6a::>vserver services name-service dns check -vserver svm_name 
   
                                 Name Server
   Vserver       Name Server     Status       Status Details
   ------------- --------------- ------------ --------------------------
   svm_name      172.31.14.245   up           Response time (msec): 0
   svm_name      172.31.25.207   up           Response time (msec): 1
   2 entries were displayed.
   ```

1. 若要將 SVM 加入 Active Directory，請執行下列命令。請注意，您必須指定 Active Directory 中尚不存在`computer_name`的 ，並提供 的目錄 DNS 名稱`-domain`。針對 `-OU`，輸入您希望 SVM 加入的 OUs，以及 DC 格式的完整 DNS 名稱。

   ```
   ::>vserver cifs create -vserver svm_name -cifs-server computer_name -domain corp.example.com -OU OU=Computers,OU=example,DC=corp,DC=example,DC=com
   ```

   若要驗證 Active Directory 連線的狀態，請執行下列命令：

   ```
   ::>vserver cifs check -vserver svm_name
                                 
                 Vserver : svm_name
                       Cifs NetBIOS Name : svm_netBIOS_name
                             Cifs Status : Running
                                    Site : Default-First-Site-Name
   Node Name       DC Server Name  DC Server IP    Status   Status Details
   --------------- --------------  --------------- ------   --------------
   FsxId0ae30e5b7f1a50b6a-01 
                   corp.example.com  
                                   172.31.14.245   up       Response time (msec): 5
   FsxId0ae30e5b7f1a50b6a-02 
                   corp.example.com  
                                   172.31.14.245   up       Response time (msec): 20
   2 entries were displayed.
   ```

1. 如果您在此聯結後無法存取共用，請判斷您用來存取共用的帳戶是否具有許可。例如，如果您使用預設`Admin`帳戶 （委派管理員） 搭配 AWS 受管 Active Directory，則必須在 ONTAP 中執行下列命令。`netbios_domain` 對應於 Active Directory 的網域名稱 （對於 `corp.example.com`，此處`netbios_domain`使用的 是 `example`)。

   ```
   FsxId0123456789a::>vserver cifs users-and-groups local-group add-members -vserver svm_name -group-name BUILTIN\Administrators -member-names netbios_domain\admin
   ```

## 使用 ONTAP CLI 修改 Active Directory 組態
<a name="using-ontap-cli-to-modify-ad"></a>

您可以使用 ONTAP CLI 來修改現有的 Active Directory 組態。 

1. 若要存取 ONTAP CLI，請執行下列命令，在 Amazon FSx for NetApp ONTAP 檔案系統或 SVM 的管理連接埠上建立 SSH 工作階段。`management_endpoint_ip` 將 取代為檔案系統管理連接埠的 IP 地址。

   ```
   [~]$ ssh fsxadmin@management_endpoint_ip
   ```

   如需詳細資訊，請參閱[使用 CLI ONTAP 管理檔案系統](managing-resources-ontap-apps.md#fsxadmin-ontap-cli)。

1. 執行下列命令來暫時關閉 SVM 的 CIFS 伺服器： 

   ```
   FsxId0123456789a::>vserver cifs modify -vserver svm_name -status-admin down
   ```

1. 如果您需要修改 Active Directory 的 DNS 項目，請執行下列命令： 

   ```
   ::>vserver services name-service dns modify -vserver svm_name -domains corp.example.com -name-servers dns_ip_1,dns_ip_2
   ```

   您可以使用 `vserver services name-service dns check -vserver svm_name`命令驗證 Active Directory DNS 伺服器的連線狀態。

   ```
   ::>vserver services name-service dns check -vserver svm_name
                                 Name Server
   Vserver       Name Server     Status       Status Details
   ------------- --------------- ------------ --------------------------
   svmciad       dns_ip_1        up           Response time (msec): 1
   svmciad       dns_ip_2        up           Response time (msec): 1
   2 entries were displayed.
   ```

1. 如果您需要修改 Active Directory 組態本身，您可以使用下列命令來變更現有的欄位，取代：
   + *computer\$1name*，如果您想要修改 SVM 的 NetBIOS （機器帳戶） 名稱。
   + *domain\$1name*，如果您想要修改網域名稱。這應與本節 () 步驟 3 中記下的 DNS 網域項目對應`corp.example.com`。
   + `organizational_unit`，如果您想要修改 OU (`OU=Computers,OU=example,DC=corp,DC=example,DC=com`)。

   您需要重新輸入用來將此裝置加入 Active Directory 的 Active Directory 登入資料。

   ```
   ::>vserver cifs modify -vserver svm_name -cifs-server computer_name -domain domain_name -OU organizational_unit
   ```

   您可以使用 `vserver cifs check -vserver svm_name`命令來驗證 Active Directory 連線的連線狀態。

1. 當您完成修改 Active Directory 和 DNS 組態時，請執行下列命令讓 CIFS 伺服器恢復：

   ```
   ::>vserver cifs modify -vserver svm_name -status-admin up
   ```

## 使用 NetApp ONTAP CLI 從 SVM 取消加入 Active Directory
<a name="using-ontap-cli-to-unjoin-ad"></a>

NetApp ONTAP CLI 也可用來依照下列步驟，從 Active Directory 退出 SVM：

1. 若要存取 ONTAP CLI，請執行下列命令，在 Amazon FSx for NetApp ONTAP 檔案系統或 SVM 的管理連接埠上建立 SSH 工作階段。`management_endpoint_ip` 將 取代為檔案系統管理連接埠的 IP 地址。

   ```
   [~]$ ssh fsxadmin@management_endpoint_ip
   ```

   如需詳細資訊，請參閱[使用 CLI ONTAP 管理檔案系統](managing-resources-ontap-apps.md#fsxadmin-ontap-cli)。

1. 執行下列命令，從 Active Directory 刪除未加入您裝置的 CIFS 伺服器。若要讓 ONTAP 刪除 SVM 的機器帳戶，請提供您最初用來將 SVM 加入 Active Directory 的登入資料。

   ```
   FsxId0123456789a::>vserver cifs modify -vserver svm_name -status-admin down
   ```

1. 如果您需要修改 Active Directory 的 DNS 項目，請執行下列命令： 

   ```
   FsxId0123456789a::vserver cifs delete -vserver svm_name
   
   In order to delete an Active Directory machine account for the CIFS server, you must supply the name and password of a Windows account with
   sufficient privileges to remove computers from the "CORP.ADEXAMPLE.COM" domain. 
   
   Enter the user name: user_name
   
   Enter the password: 
   
   Warning: There are one or more shares associated with this CIFS server
            Do you really want to delete this CIFS server and all its shares? {y|n}: y
   ```

1. 執行下列命令來刪除 Active Directory 的 DNS 伺服器：

   ```
   ::vserver services name-service dns delete -vserver svm_name
   ```

   如果您看到如下所示的警告 - 指出 `dns`應該移除為 `ns-switch`- 而且您未打算將此裝置重新加入 Active Directory，您可以移除`ns-switch`項目。

   ```
   Warning: "DNS" is present as one of the sources in one or more ns-switch databases but no valid DNS configuration was found for Vserver
            "svm_name". Remove "DNS" from ns-switch using the "vserver services name-service ns-switch" command. Configuring "DNS" as a source
            in the ns-switch setting when there is no valid configuration can cause protocol access issues.
   ```

1. （選用） 執行下列命令`dns`來移除 `ns-switch`的項目。驗證來源順序，然後修改 以移除`hosts`資料庫`dns`的項目，`sources`使其僅包含列出的其他來源。在此範例中，唯一的其他來源是 `files`。

   ```
   ::>vserver services name-service ns-switch show -vserver svm_name -database hosts
   
                        Vserver: svm_name
   Name Service Switch Database: hosts
      Name Service Source Order: files, dns
   ```

   ```
   ::>vserver services name-service ns-switch modify -vserver svm_name -database hosts -sources files
   ```

1.  （選用） 將資料庫主機`sources`的 修改為僅包含 ，以移除`dns`項目`files`。

   ```
   ::>vserver services name-service ns-switch modify -vserver svm_name -database hosts -sources files
   ```