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

# Microsoft Power Automate

> You can connect Microsoft Power Automate to Connect AI via the OpenAPI specification or via Virtual SQL Server API.

## Prerequisites for Connecting via OpenAPI

Before you connect via OpenAPI, you must first do the following:

* Connect a data source to your Connect AI account. See [Sources](/ja/Sources) for more information.
* [Add a workspace](/ja/Workspaces#add-a-workspace) to Workspaces.
* [Add assets](/ja/Workspaces#workspace-assets) to your workspace.
* Generate a Personal Access Token (PAT) on the [Settings](/ja/Settings#personal-access-tokens) page. Copy this down, as it acts as your password during authentication.

## Connect via OpenAPI

To establish a connection from Microsoft Power Automate to Connect AI via OpenAPI, follow these steps.

<Steps>
  <Step>
    In **Workspaces** in Connect AI, select a workspace and download the OpenAPI specification for the workspace. See [OpenAPI](/ja/API/OpenAPI) for more information.

    <Note>
      You must use OpenAPI version 2.0 and select **Convert array types to strings**.
    </Note>

    <Frame>
      <img src="https://mintcdn.com/cdata/DDl5yMaSE1cK608F/ja/images/powerautomate_client_endpoints.png?fit=max&auto=format&n=DDl5yMaSE1cK608F&q=85&s=652615f82301983a4b122d67b16d11d5" alt="" width="750" height="533" data-path="ja/images/powerautomate_client_endpoints.png" />
    </Frame>
  </Step>

  <Step>
    Log in to Microsoft Power Automate.
  </Step>

  <Step>
    Select **Custom connectors** to create a custom connector (you may need to click **More** > **Discover all** to find **Custom connectors**).
  </Step>

  <Step>
    Select **New custom connector** > **Import an OpenAPI file**.

    <Frame>
      <img src="https://mintcdn.com/cdata/DDl5yMaSE1cK608F/ja/images/powerapps_importopenAPI.png?fit=max&auto=format&n=DDl5yMaSE1cK608F&q=85&s=834570a645ddc9fe6ef23ad9171f6afa" alt="" width="387" height="387" data-path="ja/images/powerapps_importopenAPI.png" />
    </Frame>
  </Step>

  <Step>
    Enter a **Connector name** and import the OpenAPI specification file you downloaded.
  </Step>

  <Step>
    In the **1. General** step, enter general information about the connector, including a description. **Host** and **Base URL** are required, but are already filled in.
  </Step>

  <Step>
    In the **2. Security** step, select an **Authentication type** of **Basic authentication**. Users have to provide a user name and password before using this API. Enter the parameter labels that users will see.

    <Note>
      When you use the custom connector, the user name is the Connect AI user name, and the password is the PAT created in the prerequisites.
    </Note>
  </Step>

  <Step>
    The **3. Definition** step of the connector defines all the actions of the connector that are contained in the OpenAPI specification file. The actions include all the functions you need for the table, including list, get, create, update, and delete records.
    In the **3. Definition** step, you can edit the **Actions**, **References**, and **Policies** imported from the OpenAPI specification.

    * **Actions**—each action in the custom connector has **General** information, as well as the **Request**, **Response**, and **Validation** of the response.
      For example, the following request is a GET request to list drives.

    <Frame>
      <img src="https://mintcdn.com/cdata/DDl5yMaSE1cK608F/ja/images/powerapps_request.png?fit=max&auto=format&n=DDl5yMaSE1cK608F&q=85&s=b7a2b745051a9babf721b8fdf65402d8" alt="" width="686" height="851" data-path="ja/images/powerapps_request.png" />
    </Frame>

    The request includes query parameters that are appended to the URL, such as `$top`, `$filter`, and `$orderby`. You can edit and delete the query parameters here. The parameters are based on the OData protocol.
    See [API Operations](/ja/API/OpenAPI#api-operations) for a complete reference.
    The **Test** step of creating a custom connector is where you can test out the query parameters.
    Similarly, there is a POST request to create a new record. The request contains all the fields for the record. You can edit these fields in the definition.

    * **References**—reusable parameters that are used by both actions and triggers. Each reference has a **Definition** and **Validation**.
    * **Policies**—used to change the behavior of actions through configuration.
  </Step>

  <Step>
    Click **Create connector** to save the custom connector.
  </Step>

  <Step>
    In the **6. Test** step, you can test the behavior of each operation defined in the OpenAPI specification by applying query parameters.
    For example, you can test the `$top` and `$orderby` query parameters by returning the top 100 records, ordered by `name`.

    <Frame>
      <img src="https://mintcdn.com/cdata/DDl5yMaSE1cK608F/ja/images/powerapps_test.png?fit=max&auto=format&n=DDl5yMaSE1cK608F&q=85&s=5417e8d131d85f83c3b91edf1f7983ba" alt="" width="674" height="513" data-path="ja/images/powerapps_test.png" />
    </Frame>
  </Step>

  <Step>
    Once the custom connector is created, click the **+** sign to create a connection with the custom connector.

    <Frame>
      <img src="https://mintcdn.com/cdata/DDl5yMaSE1cK608F/ja/images/powerautomate_client_create_conn.png?fit=max&auto=format&n=DDl5yMaSE1cK608F&q=85&s=db0d0ffc5d654e7fcf5dd2d2a8121244" alt="" width="1103" height="224" data-path="ja/images/powerautomate_client_create_conn.png" />
    </Frame>
  </Step>

  <Step>
    Provide your Connect AI user name and password. The password is the PAT created in the prerequisites.
  </Step>

  <Step>
    Go to **My flows**. Select **New flow** > **Instant cloud flow**. The **Build an instant cloud flow** dialog appears.

    <Frame>
      <img src="https://mintcdn.com/cdata/DDl5yMaSE1cK608F/ja/images/powerautomate_client_cloud_flow.png?fit=max&auto=format&n=DDl5yMaSE1cK608F&q=85&s=7a3fc05c57c696261afe354c759b23dc" alt="" width="1124" height="714" data-path="ja/images/powerautomate_client_cloud_flow.png" />
    </Frame>
  </Step>

  <Step>
    Enter a flow name and trigger, and click **Create**.
  </Step>

  <Step>
    Click **+** to add an action.
  </Step>

  <Step>
    Select **Custom** from the **Runtime** drop-down list and click the custom connector you created.

    <Frame>
      <img src="https://mintcdn.com/cdata/DDl5yMaSE1cK608F/ja/images/powerautomate_client_add_action.png?fit=max&auto=format&n=DDl5yMaSE1cK608F&q=85&s=2967df939b64853f99b814b9a6963aec" alt="" width="748" height="545" data-path="ja/images/powerautomate_client_add_action.png" />
    </Frame>
  </Step>

  <Step>
    Choose the request you want to send. Once the flow is successfully completed, you can test the outputs for your flow.
  </Step>
</Steps>

## Prerequisites for Connecting via Virtual SQL Server API

Before you connect via the Virtual SQL Server API, you must first do the following:

* Connect a data source to your Connect AI account. See [Sources](/ja/Sources) for more information.
* If you want to connect to a Connect AI workspace, [add a workspace](/ja/Workspaces#add-a-workspace) to Workspaces and [add assets](/ja/Workspaces#workspace-assets) to your workspace.
* Generate a Personal Access Token (PAT) on the [Settings](/ja/Settings#personal-access-tokens) page. Copy this down, as it acts as your password during authentication.

## Connect via the Virtual SQL Server API

<Steps>
  <Step>
    Log in to Microsoft Power Automate.
  </Step>

  <Step>
    In the navigation menu, open **More** > **Connections**.

    <Frame>
      <img src="https://mintcdn.com/cdata/DDl5yMaSE1cK608F/ja/images/powerautomate_client_01.png?fit=max&auto=format&n=DDl5yMaSE1cK608F&q=85&s=ab771301741ec0852372f7f66fae4854" alt="" width="1355" height="1452" data-path="ja/images/powerautomate_client_01.png" />
    </Frame>
  </Step>

  <Step>
    Click **New connection** to open the list of available connections.
  </Step>

  <Step>
    Select **SQL Server**. In the dialog that appears, select **SQL Server Authentication**.

    <Frame>
      <img src="https://mintcdn.com/cdata/DDl5yMaSE1cK608F/ja/images/powerautomate_client_02.png?fit=max&auto=format&n=DDl5yMaSE1cK608F&q=85&s=d788c6aaa7f57ad36da97fb3b98b51b8" alt="" width="1427" height="1210" data-path="ja/images/powerautomate_client_02.png" />
    </Frame>
  </Step>

  <Step>
    Enter the connection settings.

    * **SQL server name**—enter the Virtual SQL Server endpoint and port separated by a comma: *tds.cdata.com*,*14333*
    * **SQL database name**—接続したいConnect AI データソースのConnection Name を入力します。例：*Salesforce1* To connect to a workspace, set the **SQL database name** to the name of your workspace (for example, *MyWorkspace*).
    * **Username**—Connect AI のユーザー名を入力します。ユーザー名は、Connect AI の画面の右上に表示されています。例：*[test@cdata.co.jp](mailto:test@cdata.co.jp)* To connect to a workspace, set the **Username** to `[CData_username]@[workspace_name]` (for example, *[test@cdata.com](mailto:test@cdata.com)@MyWorkspace*).
    * **Password**—[Settings](/ja/Settings#personal-access-tokens) ページで生成したPAT を入力します。
    * Leave the **Choose a gateway** field blank.
      *Connecting to a source*:

    <Frame>
      <img src="https://mintcdn.com/cdata/DDl5yMaSE1cK608F/ja/images/powerapps_create.png?fit=max&auto=format&n=DDl5yMaSE1cK608F&q=85&s=7d3e7b1a5752b3d981fbdfbf49e9585e" alt="" width="755" height="629" data-path="ja/images/powerapps_create.png" />
    </Frame>

    *Connecting to a workspace*:

    <Frame>
      <img src="https://mintcdn.com/cdata/DDl5yMaSE1cK608F/ja/images/powerapps_workspace.png?fit=max&auto=format&n=DDl5yMaSE1cK608F&q=85&s=d628ffcdd21f2e717b19854e0e2a5706" alt="" width="751" height="618" data-path="ja/images/powerapps_workspace.png" />
    </Frame>
  </Step>

  <Step>
    Click **Create** to establish the connection.
  </Step>
</Steps>

Your connection now appears in your connection list. You can add more data sources from your Connect AI account by repeating this process and entering a different **SQL database name**.

## Learn More

For more information about SQL Server connections in Microsoft Power Automate, please see [Microsoft’s support article](https://learn.microsoft.com/en-us/connectors/sql/).
