# Azureストレージへの接続

Azure ストレージを Mindkosh に接続してデータを追加するには、最初に Azure の資格情報を追加する必要があります。

{% hint style="warning" %}
ご自身のクラウドサービスアカウントを Mindkosh に接続する際、クラウドストレージのデータ送信（egress）料金が発生する場合があります。詳細はクラウドプロバイダーにご確認ください。&#x20;
{% endhint %}

### Azure の資格情報を作成する

ストレージを Mindkosh に接続する推奨方法は、次を使用することです *Azure Active Directory* （別名 *Azure Entra ID*）。資格情報を作成するには、次の手順を行ってください：

1. まだ作成していない場合はリソースグループを作成します。  [ここに記載された手順に従ってください](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/manage-resource-groups-portal).
2. まだ作成していない場合はストレージアカウントを作成します。 [ここにある手順に従うことができます。](https://learn.microsoft.com/en-us/azure/storage/common/storage-account-overview)
3. データを格納するストレージコンテナを作成します。 [ここに記載された手順に従ってください](https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-portal).
4. Azure Active Directory を通じてサービスユーザーを作成するには、新しいアプリを登録します。 [これを行うためのガイドはこちらです](https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app).
   1. アプリを登録したら、アクセス用の資格情報を作成できます。ストレージデータにアクセスするために次のトークンが必要なので、次の手順のために手元に用意してください。
      1. client-id
      2. client-secret
      3. tenant-id\ <br>

         <div data-full-width="true"><figure><img src="/files/9de4d4c54b0e3632751b6cdd36cc1d8d4c7123bd" alt=""><figcaption></figcaption></figure></div>
5. 関連するバケットへのアクセスを含むロールベースのアクセス ポリシーをユーザーに割り当てます。これを行うさまざまな方法について詳しくは、 [ここで確認できます](https://learn.microsoft.com/en-us/azure/role-based-access-control/role-assignments-portal?tabs=delegate-condition)。例えば、コンテナレベルでアクセスを付与したい場合：
   1. ストレージコンテナに移動します
   2. 左サイドバーの IAM セクションに移動します
   3. 「ロールの割り当ての追加」をクリックします
   4. ロールを追加します *Storage Blob Data Reader* と上で作成したアプリケーション

### CORS の設定

ブラウザがクラウドストレージからファイルを直接取得できるようにするには、バケットに適切な CORS ポリシーを設定して、ブラウザがファイルの読み込みをブロックしないようにする必要があります。Azure のコンテナでの設定方法は次のとおりです。

<figure><img src="/files/47cbda0770702053ecdbcbe47852cb8dba94a8a2" alt=""><figcaption></figcaption></figure>

1. コンテナページに移動します
2. 左サイドバーの設定セクションにある CORS ページに移動します
3. 次の値を設定します
   1. Allowed origins : `app.mindkosh.com`
   2. Allowed methods: `GET`
   3. Allowed headers: `*`
   4. Exposed headers: `content-length`
   5. Max-age: `120`

## Mindkosh に資格情報を追加する

{% hint style="danger" %}
クラウドストレージの資格情報を Mindkosh に追加できるのは組織の管理者のみです&#x20;
{% endhint %}

権限の設定が完了したら、資格情報を Mindkosh に追加する準備が整います。クラウドストレージの資格情報を追加するには、Mindkosh の左サイドバーから組織ページに移動してください。&#x20;

<figure><img src="/files/3f20aec08ce7c1123ced0decb60b941922d1a246" alt=""><figcaption></figcaption></figure>

MS Azure セクションの「Manage Keys」ボタンをクリックし、次のキーを適切なボックスに入力します：

1. `client-id`
2. `client-secret`
3. `tenant-id`&#x20;

資格情報を設定したら、ストレージからデータを追加するためのデータセットを作成できます。 [これを行う手順はここに記載されています。](/ja/guan-li/dtasetto/dtanoappurdo.md#adding-data-from-ms-azure)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mindkosh.com/ja/guan-li/dtasetto/azuresutorjiheno.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
