

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

# 建立 Azure Cosmos DB 連線
<a name="creating-azurecosmos-connection"></a>

**先決條件：**
+ 在 Azure 中，您將需要識別或產生 Azure Cosmos 資料庫金鑰以供 AWS Glue使用`cosmosKey`。如需詳細資訊，請參閱《Azure 文件》中的[安全存取 Azure Cosmos DB 中的資料](https://learn.microsoft.com/en-us/azure/cosmos-db/secure-access-to-data?tabs=using-primary-key)。

**設定連至 Azure Cosmos DB 的連線：**

1. 在 中 AWS Secrets Manager，使用您的 Azure Cosmos 資料庫金鑰建立秘密。若要在 Secrets Manager 中建立秘密，請遵循 AWS Secrets Manager 文件中[建立 AWS Secrets Manager 秘密](https://docs.aws.amazon.com//secretsmanager/latest/userguide/create_secret.html)中提供的教學課程。建立機密之後，請保留機密名稱 {{secretName}}，以便進行下一個步驟。
   + 在選取**鍵/值組**時，請使用 {{cosmosKey}} 值來建立 `spark.cosmos.accountKey` 金鑰對。

1. 在 AWS Glue 主控台中，依照中的步驟建立連線[新增 AWS Glue 連線](console-connections.md)。建立連線之後，請保留連線名稱 {{connectionName}}，以便未來在 AWS Glue中使用。
   + 選取**連線類型**時，請選取 Azure Cosmos DB。
   + 選取 **AWS 機密**時，請提供 {{secretName}}。