> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sync.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Azure Cosmos DB

CData Sync アプリケーションからAzure Cosmos DB コネクタを使用して、Azure Cosmos DB からデータを取得してサポートされている任意の同期先に移動できます。これを行うには、コネクタを追加し、コネクタへの認証を行い、接続を完了する必要があります。

## Azure Cosmos DB コネクタを追加

Sync でAzure Cosmos DB のデータを使用できるようにするには、まず以下の手順でコネクタを追加する必要があります：

<ol>
  <li>Sync のダッシュボードから**接続**ページを開きます。</li>
  <li>**接続を追加**をクリックして**コネクタを選択**ページを開きます。</li>
  <li>**データソース**タブをクリックして
  **Azure Cosmos DB** 行に移動します。</li>

  <li>
    行末にある**接続を設定**アイコンをクリックして、**新しい接続**ページを開きます。この操作により、
    **接続を追加**ダイアログボックスが開きます。

    **Note：** **接続を設定**アイコンが表示されない場合は、**コネクタをダウンロード**アイコンをクリックして Azure Cosmos DB コネクタをインストールしてください。
  </li>

  <li>**接続を追加**ダイアログボックスに接続名を入力します。</li>
  <li>**追加**をクリックして、コネクタの**設定**タブを開きます。</li>
</ol>

新しいコネクタのインストールについての詳細は、
[接続](https://docs.sync.cdata.com/26.4/ja/connections/connections.md)を参照してください。

## Verify the Role Assignment for Your Azure Identity

Before you connect to Azure Cosmos DB, you need to ensure that your Azure identity is assigned the correct role. The identity is the account that you use to log in to the browser (during Azure Active Directory authentication) or into the application (for Azure Service Principal authentication).

You can create custom role definitions:

* CosmosDB Built-in Data Reader
* CosmosDB Built-in Data Contributor

In addition, you can create custom role definintions.

You must also set the scope of the role assignment, where "/" specifies that the identity can access all the databases.

For more details about assigning roles, see [Configure role-based access control with Microsoft Entra ID for your Cosmos DB account](https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-setup-rbac).

## Azure Cosmos DB への認証

After you add the connector, you need to set the required properties.

**Account Endpoint:** Enter the Cosmos DB account URL. This URL is available the **Keys** blade (**Settings > Keys**) of your Cosmos DB account.

CData Sync supports authenticating to Azure Cosmos DB in several ways. Select your authentication method below to proceed to the relevant section that contains the authentication details.

* [**AccountKey**](#account-key) (default)
* [**AzureAD**](#azure-active-directory)
* [**AzureServicePrincipal**](#azure-service-principal)
* [**AzureServicePrincipalCert**](#azure-service-principal-certificate)

### Account Key

To connect with account-key credentials, specify the following properties:

* **Auth Scheme:** Select **AccountKey**.
* (Default) **Account Key:** Enter the master key token or resource token that is required to connect to the Azure Cosmos DB REST API.
* **Token Type:** Select the type of token (**master** or **resource**) that you are using in the **Account Key** field. The default token type is **master**.

### Azure Active Directory

Azure Active Directory（AD）ユーザーアカウントで接続するには、**Auth Scheme** で**AzureAD** を選択します。CData Sync は、接続するための組み込みOAuth アプリケーションを提供するため、追加のプロパティは必要ありません。

### Azure Service Principal

Azure サービスプリンシパルとクライアントシークレットで接続するには、次のプロパティを設定します：

<ul><li>\*\*Auth Scheme：\*\***AzureServicePrincipal** を選択。</li>
<li>\*\*Azure Tenant：\*\*接続するMicrosoft Online テナントを入力。</li>
<li>\*\*OAuth Client Id：\*\*OAuth 認証サーバーにアプリケーションを登録した際に割り当てられたクライアントId を入力。</li>
<li>\*\*OAuth Client Secret：\*\*OAuth 認証サーバーにアプリケーションを登録した際に割り当てられたクライアントシークレットを入力。</li></ul>

アプリケーションのOAuth クライアントId およびクライアントシークレットを取得するには：

<ol><li>[Azure ポータル](https://portal.azure.com)にログインします。</li>
<li>左ナビゲーションペインで**すべてのサービス**を選択します。次に**アプリの登録**を検索し選択します。</li>
<li>**新規登録**をクリックします。</li>
<li>アプリケーションの名前を入力して**任意のAzure AD ディレクトリ - マルチテナント**を選択します。</li>
<li>アプリケーションを作成したら、**概要**セクションに表示されるアプリケーション (クライアント) ID の値をコピーします。この値をOAuth クライアントId として使用します。</li>
<li>**証明書とシークレット**セクションに移動して、アプリケーションの**新しいクライアント シークレット**を選択します。</li>
<li>有効期間を指定してクライアントシークレットを保存します。保存するとキーの値が表示されます。</li>
<li>値は一度しか表示されないので、コピーしておきます。この値をOAuth クライアントシークレットとして使用します。</li>
<li>**認証**タブで、必ず**アクセストークン (暗黙的なフローに使用)** を選択します。</li></ol>

### Azure Service Principal Certificate

Azure サービスプリンシパルとクライアント証明書で接続するには、次のプロパティを設定します：

<ul><li>\*\*Auth Scheme：\*\***AzureServicePrincipalCert** を選択。</li>
<li>\*\*Azure Tenant：\*\*接続するMicrosoft Online テナントを入力。</li>
<li>\*\*OAuth Client Id：\*\*OAuth 認証サーバーにアプリケーションを登録した際に割り当てられたクライアントId を入力。</li>
<li>\*\*OAuth JWT Cert：\*\*Java web token（JWT）証明書ストアを入力。</li>
<li>**OAuth JWT Cert Type：**JWT 証明書を格納するキーストアの種類を入力。デフォルトの種類は**PEMKEY\_BLOB** です。</li>
<li>（オプション）\*\*OAuth JWT Cert Password：\*\*OAuth JWT 証明書のパスワードを入力。</li>
<li>（オプション）\*\*OAuth JWT Cert Subject：\*\*OAuth JWT 証明書のサブジェクトを入力。</li></ul>

アプリケーションのOAuth 証明書を取得するには：

<ol><li>[Azure ポータル](https://portal.azure.com)にログインします。</li>
<li>左ナビゲーションペインで**すべてのサービス**を選択します。次に**アプリの登録**を検索し選択します。</li>
<li>**新規登録**をクリックします。</li>
<li>アプリケーションの名前を入力して**任意のAzure AD ディレクトリ - マルチテナント**を選択します。</li>
<li>アプリケーションを作成したら、**概要**セクションに表示されるアプリケーション (クライアント) ID の値をコピーします。この値をOAuth クライアントId として使用します。</li>
<li>**証明書とシークレット**セクションに移動して、**証明書のアップロード**を選択します。次に、ローカルマシンからアップロードする証明書を選択します。</li>
<li>有効期間を指定してクライアントシークレットを保存します。保存するとキーの値が表示されます。</li>
<li>値は一度しか表示されないので、コピーしておきます。この値をOAuth クライアントシークレットとして使用します。</li>
<li>**認証**タブで、必ず**アクセストークン (暗黙的なフローに使用)** を選択します。</li></ol>

## 接続を完了する

To complete your connection:

1. For the **Schema** property (optional), enter the schema (the Azure Cosmos DB database) with which you want to work.
2. Define advanced connection settings on the **Advanced** tab. (In most cases, though, you should not need these settings.)
3. If you authenticate with AzureAD, click **Connect to Azure Cosmos DB** to connect to your Azure Cosmos DB account.
4. Click **Create & Test** to create your connection.

## 詳細について


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.