

支援終止通知：2027 年 3 月 31 日， AWS 將終止對 Amazon WorkMail 的支援。2027 年 3 月 31 日之後，您將無法再存取 Amazon WorkMail 主控台或 Amazon WorkMail 資源。如需詳細資訊，請參閱 [Amazon WorkMail 終止支援](https://docs.aws.amazon.com/workmail/latest/adminguide/workmail-end-of-support.html)。

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

# 啟用 AutoDiscover 來設定端點
<a name="autodiscover"></a>

AutoDiscover 可讓您僅使用您的電子郵件地址和密碼來設定 Microsoft Outlook 和行動用戶端。服務會維護與 Amazon WorkMail 的連線，並在您變更端點或設定時更新本機設定。此外，AutoDiscover 可讓您的用戶端使用其他 Amazon WorkMail 功能，例如離線通訊錄、Out-of-Office助理，以及在行事曆中檢視免費/忙碌時間的功能。

用戶端執行以下 AutoDiscover 階段以偵測伺服器端點 URL：
+ **階段 1** – 用戶端會對本機 Active Directory 執行安全複製通訊協定 (SCP) 查詢。如果您的用戶端沒有加入的網域，則 AutoDiscover 略過此步驟。
+ **階段 2** – 用戶端傳送請求至下列 URLs 並驗證結果。這些端點只能使用 HTTPS。
  + https：//*company.tld*/autodiscover/autodiscover.xml 
  + https://autodiscover.*company.tld*/autodiscover/autodiscover.xml
+ **階段 3** – 用戶端執行 DNS 查詢以 autodiscover.company.tld，並從使用者的電子郵件地址將未經驗證的 GET 請求傳送至衍生的端點。如果伺服器傳回一個 302 重新導向，用戶端會針對回傳的 HTTPS 端點重新傳送 AutoDiscover 的請求。

如果所有這些階段都失敗，則無法自動設定用戶端。有關手動設定行動裝置的詳細資訊，請參閱[手動連接您的裝置](https://docs.aws.amazon.com/workmail/latest/userguide/manually_connect_device.html)。

當您將網域新增至 Amazon WorkMail 時，系統會提示您將 AutoDiscover DNS 記錄新增至您的提供者。這可讓用戶端執行 AutoDiscover 程序的階段 3。不過，這些步驟不適用於所有行動裝置，例如股票 Android 電子郵件應用程式。因此，您可能需要手動設定 AutoDiscover 階段 2。

您可以使用下列方法來設定網域的 AutoDiscover 階段 2：

## （建議） 使用 Route 53 和 Amazon CloudFront
<a name="use-r53"></a>

**注意**  
下列步驟說明如何為 https://autodiscover.*company.tld*/autodiscover/autodiscover.xml 建立代理。若要建立 https：//*company.tld*/autodiscover/autodiscover.xml 的代理，請在下列步驟中移除網域的`autodiscover.`字首。  
使用 CloudFront 和 Route 53 可能會產生費用。如需適用定價的詳細資訊，請參閱 [Amazon CloudFront 定價](https://aws.amazon.com/cloudfront/pricing/)和 [Amazon Route 53 定價](https://aws.amazon.com/route53/pricing/)。

**使用 Route 53 和 CloudFront 啟用 AutoDiscover 階段 2**

1. 取得 autodiscover.*company.tld* 的 SSL 憑證，並將其上傳至 AWS Identity and Access Management (IAM) 或 AWS Certificate Manager。如需詳細資訊，請參閱《*IAM 使用者指南*》中的[使用伺服器憑證](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_server-certs.html)，或*AWS Certificate Manager 《 使用者指南*》中的[入門](https://docs.aws.amazon.com/acm/latest/userguide/gs.html)。

1. 建立新的 CloudFront 分佈：

   1. 在 [https://console.aws.amazon.com/cloudfront/v4/home](https://console.aws.amazon.com/cloudfront/v4/home) 中開啟 CloudFront 主控台。

   1. 在導覽窗格中，選擇 **Distributions (分佈)**。

   1. 選擇 **Create Distribution (建立分佈)**。

   1. 在 **Web** 下，選擇**開始使用**。

   1. 在**原始伺服器設定**中，輸入下列值：
      + **原始網域名稱** – 您區域的適當網域名稱：
        + 美國東部 （維吉尼亞北部） — **autodiscover-service.mail.us-east-1.awsapps.com**
        + 美國西部 （奧勒岡） — **autodiscover-service.mail.us-west-2.awsapps.com**
        + 歐洲 （愛爾蘭） — **autodiscover-service.mail.eu-west-1.awsapps.com**

        
      + **原始通訊協定政策** – 所需的政策： **Match Viewer**
**注意**  
將**原始路徑**保留空白。請勿變更**原始伺服器 ID** 的自動填入值。

   1. 在**預設快取行為設定**中，為列出的設定選取下列值：
      + **Viewer Protocol Policy** (檢視器通訊協定政策)：僅 HTTPS
      + **Allowed HTTP Methods** (允許的 HTTP 方法)：GET、HEAD、OPTIONS、PUT、POST、PATCH、DELETE
      + **Cache Based on Selected Request Headers** (根據選取的請求標題快取)：所有
      + **Forward Cookies (轉送 Cookies)**：所有
      + **Query String Forwarding and Caching** (轉發和快取查詢字串)：無 (提升快取) 
      + **Smooth Streaming**：否 
      + **Restrict Viewer Access** (限制檢視器存取)：否 

   1. 請為 **Distribution Settings (分佈設定)** 填寫以下的值：
      + **Price Class** (價格分級)：只有使用美國、加拿大和歐洲
      + 對於**備用網域名稱 (CNAMEs)**，輸入 **autodiscover.*company.tld***或 ***company.tld***，其中 *company.tld* 是您的網域名稱。
      + **SSL 憑證**：自訂 SSL 憑證 （存放在 IAM 中）
      + **Custom SSL Client Support (自訂 SSL 用戶端支援)**：選擇 **All Clients (所有用戶端)** 或 **Only Clients that Support Server Name Indication (SNI) (只限支援伺服器名稱指示 (SNI) 的用戶端)**。舊版 Android 可能不適用於後者選項。
**注意**  
如果您選擇 **All Clients (所有用戶端)**，請保留 **Default Root Object (預設根物件)** 空白。
      + **Logging (記錄)**：選擇 **On (開啟)** 或 **Off (關閉)**。**在 **上啟用記錄。
      + 在 **Comment (註解)** 中，輸入 **AutoDiscover type2 for autodiscover.*company.tld***
      + **分佈狀態**：選擇**已啟用**。

   1. 選擇 **Create Distribution (建立分佈)**。

1. 在 Route 53 主控台中，建立記錄，將網域名稱的網際網路流量路由到您的 CloudFront 分佈。
**注意**  
這些步驟假設 example.com 的 DNS 記錄託管在 Route 53 上。如果您不使用 Route 53，請遵循 DNS 供應商管理主控台中的程序。

   1. 在主控台的導覽窗格中，選擇**託管區域**。然後選擇網域。

   1. 在網域清單中，選擇您要使用的網域名稱。

   1. 在**記錄中**，選擇**建立記錄**。

   1. 在**快速建立記錄**下，設定下列參數：
      + 在**記錄名稱**下，輸入記錄的名稱。
      + 在**路由政策**下，選取**簡易路由**。
      + 選擇**別名**滑桿以將其開啟。當 處於開啟狀態時，滑桿會變成藍色。
      + 在**記錄類型**清單中，選擇 **A - 將流量路由到 IPv4 地址和一些 AWS 資源**。
      + 在**要列出的路由流量**中，選擇 ** CloudFront 分佈的別名**。
      + 搜尋方塊會出現在**要列出的路由流量**下方。在文字方塊中輸入 CloudFront 分發的名稱。您也可以從選取搜尋方塊時顯示的清單中選取分佈。

   1. 選擇**建立記錄**。

## 使用 Apache Web 伺服器
<a name="use-apache"></a>

下列步驟說明如何使用 Apache Web 伺服器為 https://autodiscover.*company.tld*/autodiscover/autodiscover.xml 建立代理。若要建立 https：//*company.tld*/autodiscover/autodiscover.xml 的代理，請移除「autodiscover」。字首於網域，依以下步驟。

**運用 Apache web 伺服器啟用 AutoDiscover 階段 2**

1. 在啟用 SSL 的 Apache 伺服器上執行下列指令：

   ```
   SSLProxyEngine on ProxyPass /autodiscover/autodiscover.xml https://autodiscover-service.mail.REGION.awsapps.com/autodiscover/autodiscover.xml
   ```

1. 視需要啟用下列 Apache 模組。如果您不知道方法，請參閱 Apache 說明：
   + `proxy`
   + `proxy_http`
   + `socache_shmcb`
   + `ssl`

如需測試和故障診斷 AutoDiscover 的相關資訊，請參閱下一節。

## AutoDiscover 階段 2 故障診斷
<a name="troubleshooting"></a>

為 AutoDiscover 設定 DNS 供應商後，您可以測試 AutoDiscover 端點組態。如果您已正確設定端點，則會以未經授權的請求訊息回應。

**進行基本未經授權的請求**

1. 從終端機建立未驗證的 POST 請求至 AutoDiscover 端點。

   ```
   $ curl -X POST -v https://autodiscover.''company.tld''/autodiscover/autodiscover.xml
   ```

   如果您的端點設定正確，應該會傳回`401 unauthorized`訊息，如下列範例所示：

   ```
   $ curl -X POST -v https://autodiscover.''company.tld''/autodiscover/autodiscover.xml
   ...
   HTTP/1.1 401 Unauthorized
   ```

1. 接著，測試真正的 AutoDiscover 請求。使用下列 XML 內容建立`request.xml`檔案：

   ```
   <?xml version="1.0" encoding="utf-8"?> 
   
   <Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/mobilesync/requestschema/2006">
       <Request>
           <EMailAddress>testuser@company.tld</EMailAddress>
           <AcceptableResponseSchema>
               http://schemas.microsoft.com/exchange/autodiscover/mobilesync/responseschema/2006
           </AcceptableResponseSchema>      
       </Request>
   </Autodiscover>
   ```

1. 使用您建立`request.xml`的檔案，並向端點提出已驗證的 AutoDiscover 請求。請記得將 *testuser@company.tld* 取代為有效的電子郵件地址：

   ```
   $ curl -d @request.xml -u testuser@company.tld -v https://autodiscover.company.tld/autodiscover/autodiscover.xml
   ```

   如果端點已正確設定，回應看起來會與下列範例類似：

   ```
   $ curl -d @request.xml -u testuser@company.tld -v https://autodiscover.company.tld/autodiscover/autodiscover.xml
   
   Enter host password for user 'testuser@company.tld':
   <?xml version="1.0" encoding="UTF-8"?>
   <Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <Response xmlns="http://schemas.microsoft.com/exchange/autodiscover/mobilesync/responseschema/2006">
       <Culture>en:us</Culture>
       <User>
           <DisplayName>User1</DisplayName>
           <EMailAddress>testuser@company.tld</EMailAddress>
       </User>
       <Action>
           <Settings>
               <Server>
                   <Type>MobileSync</Type>
                   <Url>https://mobile.mail.us-east-1.awsapps.com/Microsoft-Server-ActiveSync</Url>
                   <Name>https://mobile.mail.us-east-1.awsapps.com/Microsoft-Server-ActiveSync</Name>
               </Server>
           </Settings>
       </Action>
   </Response>
   ```