

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

# 步驟 2：建立 AWS Managed Microsoft AD Active Directory
<a name="microsoftadbasestep2"></a>

您可以使用三種不同的方法來建立目錄。您可以使用 程序 AWS 管理主控台 （本教學課程建議），也可以使用 AWS CLI 或 AWS Tools for Windows PowerShell 程序來建立目錄。

**方法 1：建立 AWS Managed Microsoft AD 目錄 (AWS 管理主控台)**

1. 在 [AWS Directory Service 主控台](https://console.aws.amazon.com/directoryservicev2/)中，選擇**目錄**，然後選擇**設定目錄**。

1. 在**選取目錄類型**頁面上，選擇 **AWS Managed Microsoft AD**，然後選擇**下一步**。

1. 在 **Enter directory information (輸入目錄資訊)** 頁面上，提供下列資訊，然後選擇 **Next (下一步)**。
   + 針對**版本**，選取**標準版**或**企業版**。如需版本的詳細資訊，請參閱 [AWS Directory Service for Microsoft Active Directory](what_is.md#microsoftad)。
   + 在 **Directory DNS name (目錄 DNS 名稱)** 中，輸入 **corp.example.com**。
   + 針對 **Directory NetBIOS name (目錄 NetBIOS 名稱)**，輸入 **corp**。
   + 針對**Directory description (目錄描述)**，輸入 **AWS DS Managed**。
   + 針對 **Admin password** (管理員密碼)，輸入此帳戶要使用的密碼，然後在 **Confirm password** (確認密碼) 中再輸入一次密碼。在建立目錄的過程中會自動建立此 **Admin** (管理員) 帳戶。密碼不得包含 *admin* 一字。目錄管理員密碼區分大小寫，長度須介於 8 至 64 個字元之間。至少須有一位字元屬於以下四種類型中的三類：
     + 小寫字母 (a-z)
     + 大寫字母 (A-Z)
     + 數字 (0-9)
     + 非英數字元 (\~\!@\#$%^&\*\_-\+=`\|\\(){}[]:;"'<>,.?/)

1. 在 **Choose VPC and subnets (選擇 VPC 和子網路)** 頁面上，提供下列資訊，然後選擇 **Next (下一步)**。
   + 對於 **VPC**，選擇開頭為 **AWS-DS-VPC01** 且結尾為 **(10.0.0.0/16)** 的選項。
   + 在 **Subnets (子網路)**，選擇 **10.0.0.0/24** 和 **10.0.1.0/24** 公有子網路。

1. 在 **Review & create (檢閱和建立)** 頁面上檢閱目錄資訊，並進行必要的變更。若資訊無誤，請選擇 **Create directory (建立目錄)**。建立目錄需要 20 到 40 分鐘。建立後，**Status** (狀態) 值會變更為 **Active** (作用中)。

**方法 2：建立 AWS Managed Microsoft AD (PowerShell) （選用）**

1. 打開 PowerShell。

1. 鍵入下列命令。請務必使用上述 AWS 管理主控台 程序的步驟 4 中提供的值。

   ```
   New-DSMicrosoftAD -Name {{corp.example.com}} –ShortName {{corp}} –Password {{P@ssw0rd}} –Description "AWS DS Managed" - VpcSettings_VpcId {{vpc-xxxxxxxx}} -VpcSettings_SubnetId {{subnet-xxxxxxxx}}, {{subnet-xxxxxxxx}}
   ```

**方法 3：建立 AWS Managed Microsoft AD (AWS CLI) （選用）**

1. 開啟 AWS CLI。

1. 鍵入下列命令。請務必使用上述 AWS 管理主控台 程序的步驟 4 中提供的值。

   ```
   aws ds create-microsoft-ad --name {{corp.example.com}} --short-name {{corp}} --password {{P@ssw0rd}} --description "AWS DS Managed" --vpc-settings VpcId= {{vpc-xxxxxxxx}},SubnetIds= {{subnet-xxxxxxxx}}, {{subnet-xxxxxxxx}}
   ```