<?xml version="1.0" encoding="utf-8" standalone="yes"?><?xml-stylesheet href="/feed_style.xsl" type="text/xsl"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="https://www.rssboard.org/media-rss">
  <channel>
    <title>cognito on MR70</title>
    <link>https://www.mr70.eu/tags/cognito/</link>
    <description>Recent content in cognito on MR70</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <copyright>MR70 - [Creative Commons Attribution 4.0 International License](https://creativecommons.org/licenses/by/4.0/).</copyright>
    <lastBuildDate>Tue, 26 May 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://www.mr70.eu/tags/cognito/index.xml" rel="self" type="application/rss+xml" /><icon>https://www.mr70.eu/logo.svg</icon>
    
    
    <item>
      <title>Connecting Microsoft Copilot Studio to an AWS Bedrock AgentCore Gateway</title>
      <link>https://www.mr70.eu/posts/copilot-studio-aws-agentcore-gateway-cognito/</link>
      <pubDate>Tue, 26 May 2026 00:00:00 +0000</pubDate>
      
      <guid>https://www.mr70.eu/posts/copilot-studio-aws-agentcore-gateway-cognito/</guid>
      <description><![CDATA[<h2 id="overview">Overview</h2>
<p>Microsoft Copilot Studio supports the <strong>Model Context Protocol (MCP)</strong> to invoke external tools. AWS Bedrock AgentCore Gateway exposes MCP servers behind a JWT authentication layer. Connecting the two requires:</p>
<ol>
<li>A <strong>Cognito User Pool</strong> with an app client configured for the Authorization Code flow</li>
<li>An <strong>AgentCore Gateway</strong> with a CUSTOM_JWT authorizer that accepts the Copilot Studio client</li>
<li>A <strong>Gateway Target</strong> pointing to the MCP runtime</li>
</ol>
<p>The resulting architecture:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-fallback" data-lang="fallback"><span style="display:flex;"><span>Copilot Studio → (OAuth2 Authorization Code) → Cognito → JWT
</span></span><span style="display:flex;"><span>     ↓
</span></span><span style="display:flex;"><span>AgentCore Gateway (validates JWT) → MCP Runtime → Tool
</span></span></code></pre></div><h2 id="prerequisites">Prerequisites</h2>
<ul>
<li>An AgentCore Gateway with a target configured to an MCP runtime</li>
<li>An Amazon Cognito User Pool with an active hosted UI domain</li>
<li>Admin access to the Copilot Studio portal</li>
</ul>
<h2 id="step-1--configure-the-cognito-app-client">Step 1 — Configure the Cognito app client</h2>
<p>The app client must support the <code>code</code> (Authorization Code) flow with a client secret:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>aws cognito-idp create-user-pool-client <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --region eu-west-1 <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --user-pool-id &lt;USER_POOL_ID&gt; <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --client-name <span style="color:#f1fa8c">&#34;copilot-studio-mcp&#34;</span> <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --generate-secret <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --allowed-o-auth-flows code <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --allowed-o-auth-scopes openid email profile mcp/invoke <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --allowed-o-auth-flows-user-pool-client <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --supported-identity-providers COGNITO <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --callback-urls <span style="color:#f1fa8c">&#34;https://placeholder.example.com&#34;</span>
</span></span></code></pre></div><blockquote>
<p>The custom scope <code>mcp/invoke</code> must exist on a resource server in the User Pool. Create it if it doesn&rsquo;t exist:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>aws cognito-idp create-resource-server <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --region eu-west-1 <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --user-pool-id &lt;USER_POOL_ID&gt; <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --identifier mcp <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --name <span style="color:#f1fa8c">&#34;MCP Server Access&#34;</span> <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --scopes <span style="color:#f1fa8c">&#39;[{&#34;ScopeName&#34;:&#34;invoke&#34;,&#34;ScopeDescription&#34;:&#34;Invoke MCP server tools&#34;}]&#39;</span>
</span></span></code></pre></div></blockquote>
<h2 id="step-2--authorize-the-client-on-the-gateway">Step 2 — Authorize the client on the Gateway</h2>
<p>The Gateway must accept the new app client&rsquo;s <code>client_id</code> in its <code>allowedClients</code> list:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>aws bedrock-agentcore-control update-gateway <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --region eu-west-1 <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --gateway-id &lt;GATEWAY_ID&gt; <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --name &lt;GATEWAY_NAME&gt; <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --role-arn &lt;GATEWAY_ROLE_ARN&gt; <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --authorizer-type CUSTOM_JWT <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --protocol-configuration <span style="color:#f1fa8c">&#39;{
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c">    &#34;mcp&#34;: {
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c">      &#34;supportedVersions&#34;: [&#34;2025-03-26&#34;],
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c">      &#34;streamingConfiguration&#34;: {&#34;enableResponseStreaming&#34;: false}
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c">    }
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c">  }&#39;</span> <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --authorizer-configuration <span style="color:#f1fa8c">&#39;{
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c">    &#34;customJWTAuthorizer&#34;: {
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c">      &#34;discoveryUrl&#34;: &#34;https://cognito-idp.eu-west-1.amazonaws.com/&lt;USER_POOL_ID&gt;/.well-known/openid-configuration&#34;,
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c">      &#34;allowedClients&#34;: [&#34;&lt;EXISTING_CLIENT_1&gt;&#34;, &#34;&lt;COPILOT_CLIENT_ID&gt;&#34;],
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c">      &#34;allowedScopes&#34;: [&#34;mcp/invoke&#34;, &#34;profile&#34;, &#34;openid&#34;, &#34;email&#34;]
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c">    }
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c">  }&#39;</span>
</span></span></code></pre></div><h2 id="step-3--configure-copilot-studio">Step 3 — Configure Copilot Studio</h2>
<p>In Copilot Studio: <strong>Agent → Tools → Add a tool → Add a Model Context Protocol server</strong>.</p>
<p>Select <strong>Manual</strong> as the OAuth type and fill in:</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>Client ID</td>
<td>The <code>client_id</code> created in Step 1</td>
</tr>
<tr>
<td>Client secret</td>
<td>The client&rsquo;s <code>client_secret</code></td>
</tr>
<tr>
<td>Authorization URL</td>
<td><code>https://&lt;DOMAIN&gt;.auth.eu-west-1.amazoncognito.com/oauth2/authorize</code></td>
</tr>
<tr>
<td>Token URL</td>
<td><code>https://&lt;DOMAIN&gt;.auth.eu-west-1.amazoncognito.com/oauth2/token</code></td>
</tr>
<tr>
<td>Refresh URL</td>
<td>(same as Token URL)</td>
</tr>
<tr>
<td>Scopes</td>
<td><code>openid email profile mcp/invoke</code></td>
</tr>
</tbody>
</table>
<p>After clicking <strong>Create</strong>, Copilot Studio generates a <strong>Redirect URL</strong>.</p>
<h2 id="step-4--register-the-redirect-url-in-cognito">Step 4 — Register the Redirect URL in Cognito</h2>
<p>Add the Copilot Studio redirect URL to the client&rsquo;s allowed callbacks:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>aws cognito-idp update-user-pool-client <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --region eu-west-1 <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --user-pool-id &lt;USER_POOL_ID&gt; <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --client-id &lt;COPILOT_CLIENT_ID&gt; <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --callback-urls <span style="color:#f1fa8c">&#34;https://global.consent.azure-apim.net/redirect/&lt;YOUR_COPILOT_CALLBACK&gt;&#34;</span> <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --supported-identity-providers COGNITO <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --allowed-o-auth-flows code <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --allowed-o-auth-scopes openid email profile mcp/invoke <span style="color:#f1fa8c">\
</span></span></span><span style="display:flex;"><span><span style="color:#f1fa8c"></span>  --allowed-o-auth-flows-user-pool-client
</span></span></code></pre></div><h2 id="step-5--test-the-connection">Step 5 — Test the connection</h2>
<p>Back in Copilot Studio, click <strong>Next → Create a new connection</strong> and authenticate with a Cognito user. If everything is configured correctly, Copilot Studio obtains an access token and starts invoking MCP tools.</p>
<h2 id="troubleshooting">Troubleshooting</h2>
<table>
<thead>
<tr>
<th>Error</th>
<th>Cause</th>
<th>Fix</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>insufficient_scope</code></td>
<td>The <code>client_id</code> is not in the Gateway&rsquo;s <code>allowedClients</code></td>
<td>Add it via <code>update-gateway</code> (Step 2)</td>
</tr>
<tr>
<td><code>invalid_scope</code></td>
<td>The scope doesn&rsquo;t exist on the resource server or isn&rsquo;t enabled on the client</td>
<td>Verify resource server and <code>AllowedOAuthScopes</code></td>
</tr>
<tr>
<td><code>redirect_uri mismatch</code></td>
<td>The Copilot redirect URL is not in the client&rsquo;s callbacks</td>
<td>Run Step 4</td>
</tr>
<tr>
<td><code>unsupported_grant_type</code></td>
<td>The client doesn&rsquo;t have the <code>code</code> flow enabled</td>
<td>Add <code>code</code> to <code>AllowedOAuthFlows</code></td>
</tr>
<tr>
<td><code>Failed to fetch outbound oauth token</code></td>
<td>The target&rsquo;s credential provider requests scopes invalid for <code>client_credentials</code></td>
<td>Use only custom scopes (e.g. <code>mcp/invoke</code>), not OIDC scopes</td>
</tr>
</tbody>
</table>
<h2 id="mcp-protocol-version">MCP protocol version</h2>
<p>Copilot Studio currently supports MCP protocol version <code>2025-03-26</code>. Make sure the Gateway is configured with this version in <code>supportedVersions</code>, otherwise the connection will fail silently.</p>
]]></description>
      
    </item>
    
    
  </channel>
</rss>
