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

# Import Copilot Studio agents

> Import and govern Copilot Studio agents in TrueFoundry

To import Copilot Studio agents into TrueFoundry, create a discovery app, give it access to Power Platform, then connect it in TrueFoundry.

## Create the discovery app

Create a new confidential Entra app named `truefoundry-agent-discovery`. TrueFoundry uses it as the Auth Data while you set up the Copilot Studio integration. It is separate from `truefoundry-app` and `agent-client`.

TrueFoundry uses this app to call:

| API | Used for |
| - | - |
| Graph `copilot/admin/catalog/packages` | Listing agents |
| Package detail (`elementDetails`) | Agent metadata and MCP or connector references |
| Power Apps custom connectors | Resolving connector swagger and MCP URLs |

Admin consent for Graph is not enough on its own. You also need the Power Platform steps below.

> [tab] Portal
>
> 1. Open the [Entra admin center](https://entra.microsoft.com) → **App registrations → New registration**.
> 2. Name the app `truefoundry-agent-discovery` (or your organization's naming standard). Choose single tenant, leave the redirect URI empty, then select **Register**.
> 3. Copy the **Application (client) ID**. This is the `client_id` for TrueFoundry Auth Data.
> 4. Go to **Certificates & secrets** and create a client secret or certificate. Store it in TrueFoundry Secrets.
> 5. Go to **API permissions → Add a permission → Microsoft Graph → Application permissions** and add:
>    * `CopilotPackages.Read.All` (required)
>    * `AgentIdentity.Read.All` (optional)
> 6. Select **Grant admin consent**.
> 7. Note the service principal (Enterprise application) for this app. You add it as a Power Platform application user in the next section.

> [tab] Azure CLI
>
> ```bash expandable theme={"dark"}
> TENANT_ID="<your-tenant-id>"
> az login --tenant "$TENANT_ID"
>
> DISCOVERY_APP=$(az ad app create \
>   --display-name truefoundry-agent-discovery \
>   --sign-in-audience AzureADMyOrg \
>   --query appId -o tsv)
> az ad sp create --id "$DISCOVERY_APP"
>
> az ad app credential reset --id "$DISCOVERY_APP" --append \
>   --display-name truefoundry-sync --years 1 --query password -o tsv
>
> GRAPH=00000003-0000-0000-c000-000000000000
> COPILOT_PKG=$(az ad sp show --id "$GRAPH" \
>   --query "appRoles[?value=='CopilotPackages.Read.All'].id | [0]" -o tsv)
> AGENT_ID=$(az ad sp show --id "$GRAPH" \
>   --query "appRoles[?value=='AgentIdentity.Read.All'].id | [0]" -o tsv)
>
> az ad app permission add --id "$DISCOVERY_APP" --api "$GRAPH" \
>   --api-permissions "${COPILOT_PKG}=Role"
> if [ -n "$AGENT_ID" ] && [ "$AGENT_ID" != "None" ]; then
>   az ad app permission add --id "$DISCOVERY_APP" --api "$GRAPH" \
>     --api-permissions "${AGENT_ID}=Role"
> fi
> az ad app permission admin-consent --id "$DISCOVERY_APP"
>
> echo "client_id=$DISCOVERY_APP"
> ```
>
> > [!WARNING]
> >
> > The `credential reset` command prints the client secret once. Copy it now and store it in TrueFoundry Secrets. It is not shown again.
>
> The permissions are **Application** permissions (`=Role`), not delegated permissions (`=Scope`). TrueFoundry signs in as the app itself, not as a user, so sync does not need a user to be signed in.

## Grant Power Platform access

Do this in **each** environment you sync from. Access does not carry across environments.

1. Open the [Power Platform admin center](https://admin.powerplatform.microsoft.com) → **Environments** → select the environment that contains your agents and connectors.
2. Create a security role: **Settings → Users + permissions → Security roles → New**.
   * Name: for example, `truefoundry-agent-discovery`
   * Uncheck **Include App Opener privileges**
   * Save, then open the role
   * Select **Show all tables** (or search for `connector`)
   * For **Connector**, set **Read → Organization**, then save
3. Add the app as an application user: **Settings → Users + permissions → Application users → New**.
   * Select the discovery app (same client ID as above), then select **Create**
   * Select **Edit security roles**, assign the role from step 2, then save

## Connect the discovery app in TrueFoundry

1. Go to **Integrations → Azure → Microsoft Copilot Studio**.
2. Create the integration, or open the existing one to edit it.
3. Enter the Auth Data:
   * **Tenant ID**: your Entra directory ID
   * **Client ID**: the discovery app's Application (client) ID
   * **Client secret** or **certificate**: use a `tfy-secret://…` reference, which is recommended
4. Save, then run the sync or import.

## Govern agents

After the agents are imported, govern each one by following the [OAuth2 governance checklist](https://www.truefoundry.com/docs/agent-platform/agent-governance/truefoundry-implementation/microsoft-copilot-studio/governance-checklist/oauth2.md).


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