---
schema_version: "1"
id: b9736e35a75c466747a8cb533951e7bab77c407d48080d279052313b715288e2
title: Microsoft Dynamics 365 for Operations Connector 2.0
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/microsoft-365-ops-connector/2.0/index.md
canonical_url: https://docs.mulesoft.com/jp/microsoft-365-ops-connector/2.0/
source_site: docs.mulesoft.com
content_type: documentation
content_hash: d832082b93bcd2463a4306648862e7e271a394a06b0c250577e27fa2aa3741dd
description: MuleSoft Documentation Site
release: "2.0"
latest: false
---
# Microsoft Dynamics 365 for Operations Connector 2.0

Microsoft Dynamics 365 for Operations 用 Anypoint Connector を使用すると、Microsoft Dynamics 365 for Operations Web API とのインテグレーションが可能になります。このコネクタは、Anypoint Studio を使用して設定することできます。このコネクタでは、OAuth 2、またはユーザー名とパスワードを使用した OAuth 2 の接続種別が可能です。

このコネクタにより、次の操作を実行できるようになります。

- Microsoft Dynamics 365 for Operations サーバーへのアクセスの認証または認証の取り消しを行う
- Microsoft Dynamics 365 for Operations サーバーに定期的なジョブを作成する
- 複数のエントリを取得する (DataSense クエリ言語を使用した取得を含む)
- 操作を実行する

リリースノート: [Microsoft Dynamics 365 for Operations Connector リリースノート](https://docs.mulesoft.com/jp/release-notes/connector/microsoft-365-ops-connector-release-notes-mule-4)​  
Exchange: [Microsoft Dynamics 365 for Finance and Operations Connector](https://www.mulesoft.com/exchange/com.mulesoft.connectors/mule-microsoft-dynamics365-for-operations-connector/)

## [](#始める前に)始める前に

- ソフトウェアの要件および互換性に関する情報は、​[「Microsoft Dynamics 365 for Operations Connector リリースノート」](https://docs.mulesoft.com/jp/release-notes/connector/anypoint-connector-release-notes)​を参照してください。
- Microsoft Dynamics 365 for Operations および Anypoint Platform (Mule Runtime Engine、Anypoint Studio、Mule フローの要素、グローバル要素を含む) に精通していること。
- 対象リソースへの接続をテストするには、ログイン情報が必要です。
- Apache Maven でこのコネクタを使用するには、 [Anypoint Exchange](https://www.mulesoft.com/exchange/com.mulesoft.connectors/mule-microsoft-dynamics365-for-operations-connector/)​ のこのコネクタの ​**\[Dependency Snippets (連動関係スニペット)\]**​ で ​`pom.xml`​ ファイルの連動関係情報を確認してください。
- Azure Active Directory で管理される Microsoft Dynamics 365 インスタンス (オンラインまたはオンプレミス) へのアクセス権が必要です。

## [](#pom-ファイル情報)POM ファイル情報

```xml
<dependency>
  <groupId>com.mulesoft.connectors</groupId>
  <artifactId>mule-microsoft-dynamics365-for-operations-connector</artifactId>
  <version>x.x.x</version>
  <classifier>mule-plugin</classifier>
</dependency>
```

`x.x.x`​ を使用しているコネクタに対応するバージョンに置き換えます。

最新の ​`pom.xml`​ ファイル情報を取得するには、​ [Anypoint Exchange](https://www.mulesoft.com/exchange/)​ でコネクタにアクセスし、​**\[Dependency Snippets (連動関係スニペット)\]**​ をクリックします。

## [](#anypoint-studio-7-での接続)Anypoint Studio 7 での接続

Anypoint Studio でコネクタを設定する手順は、次のとおりです。

1. プロジェクトにコネクタを追加します。
2. コネクタを設定します。
3. コネクタの入力元を設定します。

### [](#exchange-を使用してコネクタを追加する)Exchange を使用してコネクタを追加する

1. Studio で Mule プロジェクトを作成します。
2. Studio タスクバーの左上にある Exchange ​**(X)**​ アイコンをクリックします。
3. Exchange で、​**\[Login (ログイン)\]**​ をクリックし、Anypoint Platform のユーザー名とパスワードを指定します。
4. Exchange で、「Operations」を検索します。
5. **\[Microsoft Dynamics 365 for Operations Connector\]**​ を選択して ​**\[Add to project (プロジェクトに追加)\]**​ をクリックします。
6. 画面の指示に従ってコネクタをインストールします。

### [](#studio-でコネクタに追加する)Studio でコネクタに追加する

1. Studio で Mule プロジェクトを作成します。
2. \[Mule Palette (Mule パレット)\] で、​**\[(X) Search in Exchange ((X) Exchange 内を検索)\]**​ をクリックします。
3. **\[Add Modules to Project (モジュールをプロジェクトに追加)\]**​ で、検索項目に「Operations」と入力します。
4. **\[Available modules (使用可能なモジュール)\]**​ で ​**\[Microsoft Dynamics 365 for Operations Connector\]**​ をクリックします。
5. **\[Add (追加)\]**​ をクリックします。
6. **\[Finish (完了)\]**​ をクリックします。

### [](#studio-で設定する)Studio で設定する

コネクタを Studio キャンバスにドラッグします。

次のグローバル要素を作成します。

- [\[Configure OAuth 2\]](<#Configure OAuth 2>)
- [\[Configure OAuth 2 Username Password\]](<#Configure OAuth 2 Username Password>)

#### [](#oauth-2-の設定)OAuth 2 の設定

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 30%;">
<col style="width: 70%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">項目</th>
<th class="tableblock halign-left valign-top">説明</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Resource (リソース)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>OAuth エンドポイント URL。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Consumer Key (コンシューマーキー)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>アプリケーションを Azure Active Directory に登録したときに割り当てられたアプリケーション ID。この ID は Azure Portal (portal.azure.com) で確認できます。​<strong>[Active Directory]</strong>​ をクリックして、ディレクトリをクリックし、アプリケーションを選択してから ​<strong>[Configure (設定)]</strong>​ をクリックします。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Consumer Secret (コンシューマーシークレット)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>アプリケーション登録ポータルでアプリケーション用に作成したシークレット。クライアントシークレットは信頼のおける方法でデバイスに保存できないため、このシークレットをネイティブアプリケーションで使用しないでください。この情報は Web アプリケーションと Web API で必要です (クライアントシークレットをサーバー側で安全に保存できます)。この ID は Azure Portal (portal.azure.com) で確認できます。クライアントシークレットは、アプリケーションと Azure サーバーのみに公開されている数値であり、これによりアプリケーションにアクセスできます。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Authorization URL (認証 URL)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>テナント固有の OAuth2.0 エンドポイント。​<code>https://login.microsoftonline.com/{tenant}/oauth2/authorize</code>​ の形式です (エンドポイントの具体的な情報の取得方法については、以前のリンク先に記載されている手順に従ってください)。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Access token URL (アクセストークン URL)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>アクセストークンを要求するためのテナント固有のエンドポイント。​<code>https://login.microsoftonline.com/{tenant}/oauth2/token</code>​ の形式です (エンドポイントの具体的な情報の取得方法については、以前のリンク先に記載されている手順に従ってください)。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Listener config (リスナー設定)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>Anypoint Studio のフローで作成された HTTP リスナーインスタンスの名前。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Callback path (コールバックパス)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>アプリケーションの URL で、アプリケーションが認証応答の送受信に使用できる (エンドポイントの具体的な取得方法については、上記のリンク先に記載されている手順に従ってください)。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Authorize path (認証パス)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>OAuth メカニズムをトリガーする URL。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>External callback URL (外部コールバック URL)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>コールバック URL に直接アクセスできない場合 (例: プロキシを使用する場合) にのみ必須。​<code>http://localhost:8081/callback</code>​ のような形式です。</p>
</div></div></td>
</tr>
</tbody>
</table>

![microsoft 365 ops as oauth2](/mulesoft/current/ja-jp/microsoft-365-ops-connector/2.0/_images/microsoft-365-ops-as-oauth2.png)

#### [](#oauth-2-ユーザー名パスワードの設定)OAuth 2 ユーザー名/パスワードの設定

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 30%;">
<col style="width: 70%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">項目</th>
<th class="tableblock halign-left valign-top">説明</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Username (ユーザー名)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>セッションの初期化に使用するユーザー名。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Password (パスワード)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>ユーザーの認証に使用するパスワード。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>リソース</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>Web API のアプリケーション ID URI (セキュアなリソース)。バージョンを指定しない、ルート URI である必要があります (例: <code>https://YOUR_ORG.operations.dynamics.com/</code>​)。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Client ID (クライアント ID)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>アプリケーションを Azure Active Directory に登録したときに割り当てられた ID。この ID は Azure Portal (portal.azure.com) で確認できます。[Active Directory] をクリックして、ディレクトリをクリックし、アプリケーションを選択してから [Configure (設定)] をクリックします。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Client Secret (クライアントシークレット)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>アプリケーション登録ポータルでアプリケーション用に作成したシークレット。クライアントシークレットは信頼のおける方法でデバイスに保存できないため、このシークレットをネイティブアプリケーションで使用しないでください。この情報は Web アプリケーションと Web API で必要です (クライアントシークレットをサーバー側で安全に保存できます)。この ID は Azure Portal (portal.azure.com) で確認できます。クライアントシークレットは、アプリケーションと Azure サーバーのみに公開されている数値であり、これによりアプリケーションにアクセスできます。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Token Request Endpoint (トークン要求エンドポイント)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>アクセストークンを取得するためにコールされるトークンエンドポイント。例: <code>https://login.windows.net/TENANT_ID/oauth2/token</code>​。この場合の TENANT_ID は Azure Active Directory ID です。</p>
</div></div></td>
</tr>
</tbody>
</table>

![microsoft 365 ops as oauth username pass](/mulesoft/current/ja-jp/microsoft-365-ops-connector/2.0/_images/microsoft-365-ops-as-oauth-username-pass.png)

## [](#ユースケース-データを受け入れて-json-に出力する)ユースケース: データを受け入れて JSON に出力する

このユースケースでは、​**Retrieve Multiple**​ 操作を使用して Microsoft Dynamics 365 for Operations の機能を操作できます。

1. Listener (HTTP) (リスナー (HTTP)) - HTTP 要求のデータを受け入れる。
2. Dynamics AX for Operations - 接続し、顧客のエンティティをすべて取得するクエリを実行する。
3. Transform message (メッセージの変換) - ​**Retrieve Multiple**​ 操作の結果を JSON 形式で出力する。

![microsoft 365 ops studio use case](/mulesoft/current/ja-jp/microsoft-365-ops-connector/2.0/_images/microsoft-365-ops-studio-use-case.png)

プロパティファイルを使用して、フローで使用する次の属性を定義します。

- `username="${operations.username}"`
- `password="${operations.password}"`
- `resource="${operations.resource}"`
- `clientId="${operations.client_id}"`
- `clientSecret="${operations.client_secret}"`
- `tokenRequestEndpoint="${operations.request_endpoint}"`

次の XML コードを Anypoint Studio に貼り付けて、フローを試してください。

```xml
<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:dynamics365ForOperations="http://www.mulesoft.org/schema/mule/dynamics365ForOperations"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/ee/core
http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd
http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http
http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/dynamics365ForOperations
http://www.mulesoft.org/schema/mule/dynamics365ForOperations/current/mule-dynamics365ForOperations.xsd">
	<http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config">
		<http:listener-connection
		host="localhost"
		port="8081" />
	</http:listener-config>
	<dynamics365ForOperations:dynamics-365-for-operations-config
		name="Dynamics_365_For_Operations_Dynamics_365_for_operations"
		doc:name="Dynamics 365 For Operations Dynamics 365 for operations">
		<dynamics365ForOperations:oauth2-user-password-connection
			username="USERNAME"
			password="PASSWORD"
			resource="https://muledev.sandbox.operations.dynamics.com"
			clientId="CLIENT_ID"
			clientSecret="CLIENT_SECRET"
			tokenRequestEndpoint="https://login.windows.net/TOKEN/oauth2/token" />
	</dynamics365ForOperations:dynamics-365-for-operations-config>
	<dynamics365ForOperations:dynamics-365-for-operations-config
	name="Dynamics_365_For_Operations_Dynamics_365_for_operations1"
	doc:name="Dynamics 365 For Operations Dynamics 365 for operations">
		<dynamics365ForOperations:oauth2-user-password-connection
		username="${operations.username}"
		password="${operations.password}"
		resource="${operations.resource}"
		clientId="${operations.client_id}"
		clientSecret="${operations.client_secret}"
		tokenRequestEndpoint="${operations.request_endpoint}" />
	</dynamics365ForOperations:dynamics-365-for-operations-config>
	<flow name="dynamics-op-testFlow">
		<http:listener doc:name="Listener" config-ref="HTTP_Listener_config" path="/retrieve" />
		<dynamics365ForOperations:retrieve-multiple doc:name="Retrieve multiple"
		config-ref="Dynamics_365_For_Operations_Dynamics_365_for_operations1">
			<dynamics365ForOperations:data-query-url ><![CDATA[https://muledev.sandbox.operations.dynamics.com/data/Customers]]></dynamics365ForOperations:data-query-url>
		</dynamics365ForOperations:retrieve-multiple>
		<ee:transform doc:name="Transform Message">
			<ee:message >
				<ee:set-payload ><![CDATA[%dw 2.0
output application/json
---
payload]]></ee:set-payload>
			</ee:message>
		</ee:transform>
	</flow>
</mule>
```

## [](#関連情報)関連情報

- [OAuth 2.0 コード付与フローを使用して Azure Active Directory Web アプリケーションへアクセスを認証する](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-protocols-oauth-code)
- [MuleSoft ヘルプセンター](https://help.mulesoft.com)