Amazon Bedrock AgentCore Gateway
For a Studio user, working with an AWS or identity administrator, who has an Amazon Bedrock AgentCore Gateway in front of tools such as a portfolio analytics or reconciliation service and wants agents to call them. Choose the sign-in the gateway uses, set it up on the gateway and in Studio, and test.
Before you start: have the gateway's URL, https://<gateway-id>.gateway.bedrock-agentcore.<region>.amazonaws.com/mcp, and read MCP server for the connector basics. On a private deployment whose outbound traffic goes through your firewall, open the hosts in Network access first.
Sign in with Entra ID client credentials
Use this when the gateway's inbound authorisation is a JSON Web Token (JWT) authoriser that trusts Microsoft Entra ID, and one service identity is enough.
- In Entra ID, register the API the gateway accepts tokens for. Note its Application (client) ID and Application ID URI (for example
api://<application-id>). Then:- Under App roles, create a role whose Allowed member types is Applications, for example with the value
Gateway.Invoke. Entra offers an application permission only for such a role. - In the API's Manifest, set
requestedAccessTokenVersion(underapi) to2; the older manifest format calls itaccessTokenAcceptedVersion. The API then issues version 2.0 access tokens, whoseverclaim reads2.0. The gateway's discovery URL in step 3 is the version 2.0 one, and it accepts only tokens from that issuer.
- Under App roles, create a role whose Allowed member types is Applications, for example with the value
- Register a second application for Studio and add a client secret. Under API permissions, add your API's application permission (the role from step 1), and have an administrator grant consent. Note its Directory (tenant) ID, Application (client) ID and the secret.
- On the gateway, set the JWT authoriser's discovery URL to
https://login.microsoftonline.com/<tenant-id>/v2.0/.well-known/openid-configurationand its allowed audiences to the API's Application (client) ID, which the token carries inaud. Leave allowed clients empty: "Entra tokens carry azp, not the client_id claim that allowed clients checks." - In Studio, create an MCP Server connector with the gateway URL as MCP Server URL, and set Sign-in method to Sign in with client credentials:
- Token URL:
https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token - Scope: the API's Application ID URI followed by
/.default, for exampleapi://<application-id>/.default. If you copy the Application ID URI, it already starts withapi://: do not add a second one. - Audience (optional): leave blank; Entra ID takes the audience from the scope.
- Client authentication: Send in the request body
- Client ID and Client secret from step 2
- Token URL:
- Click Test connection.
Sign in as each person with Entra ID (on behalf of the user)
Use this when each call must carry the person who asked, not a shared service identity. Each person connects once with Connect Microsoft account; Studio keeps their refresh token and uses it to get an access token for the gateway's API, so the token the gateway receives is that person's own delegated token. Studio reuses that access token until shortly before it expires, then redeems the refresh token for a new one, which keeps calls fast and avoids asking Microsoft for a token on every call. The gateway sees who they are in the token's oid and tid claims, and the Studio app that acted for them in azp.
This is the recommended method for a gateway behind Entra ID when each call must carry the person: it asks only for the Microsoft values a gateway needs, and Studio applies Microsoft's sign-in rules for it. Sign in with OAuth (each person) also works with the same gateway.
-
In Entra ID, register the API as above, add a delegated scope under Expose an API such as
access_as_user(in full,api://<application-id>/access_as_user), and setrequestedAccessTokenVersionto2in its manifest, as in step 1 above. No app role is needed for this method. -
Register a second application for Studio and add a client secret. Give it the delegated permission to your API and have an administrator grant consent. Note its Directory (tenant) ID, Application (client) ID and the secret.
An administrator's consent for the whole organisation spares each person the consent prompt. A person whose consent is missing, or still waits for an administrator's approval, sees "Your organisation has not yet allowed this app to act for you. Ask your Microsoft Entra administrator to grant consent." The connect card in chat and the Inbox show the same sentence.
-
Set up the gateway's JWT authoriser as in step 3 above.
-
In Studio, create an MCP Server connector with the gateway URL, set Sign-in method to Sign in with Microsoft (each person), and fill Directory (tenant) ID, Application (client) ID, Client secret and Scope: the full delegated scope, for example
api://<application-id>/access_as_user. Studio addsoffline_access,openidandprofileitself. The tenant and client IDs are part of the connector, so they travel with it through a Library; the secret does not.The full scope is the Application ID URI, a slash and the scope name. A bare name such as
access_as_useris read by Microsoft as a Microsoft Graph permission, so the gateway would receive a token meant for Microsoft Graph and refuse it. Studio refuses a scope without its API and a doubledapi://. -
Click Check sign-in and add the Redirect URI it shows to the Studio app's registration in Entra ID: on its Authentication page, add it under Web, not under Single-page application or Mobile and desktop applications. Studio completes the sign-in on its own servers with the client secret, and Microsoft accepts that only for a Web redirect URI. It has the form
https://<your Studio address>/data-connector/connectors/oauth/callback, is the same for every connector in this Studio, and also appears as Sign-in redirect URI on the deployment's Overview in Organisations (Deployment detail). Add one for each Studio that uses the app. -
Create the connector, click Connect Microsoft account and sign in with the Microsoft account you use for Studio. Click Test with my account, then list the tools and choose their access (Choose the tools agents may use).
Everyone who uses the connector repeats step 6 with their own account; until then they see the connect card in chat (MCP: each person signs in). When Microsoft asks for a new sign-in (for example a Conditional Access rule, an expired session or a changed password), the connector shows Connect again and the person signs in again; if Microsoft names an extra requirement, Studio asks for it on the next Connect Microsoft account. A rejected client secret is for the connector's owner to fix.
Disabling a person or revoking their sessions in Entra ID stops their calls once the access token Studio holds for them expires, usually within 60 to 90 minutes, depending on your tenant's token lifetime.
Sign in with OAuth (each person)
Use this when each call must carry the person who asked and you prefer Studio to find the sign-in service from the gateway itself. For a gateway behind Entra ID, Sign in with Microsoft (each person) remains the recommended method; both send the gateway the same kind of token, issued to the person.
When the sign-in service the gateway names is Microsoft Entra ID, Studio follows Microsoft's rules for it:
- It sends no
resourceparameter. Entra accepts one only when it names the scope's own API, and a gateway URL never does, so the scope alone tells Microsoft which API the token is for. - It adds
offline_accessto the scope, so Microsoft issues a refresh token and each person stays connected after the first access token expires. - It needs a Scope when the gateway lists none, because Entra issues a token for your API only when the request names that API's scope. Check sign-in, Test connection and Connect say "Enter the Scope. This server signs in with Microsoft Entra ID, which needs the API's full scope, for example <application ID>/.default or <Application ID URI>/access_as_user.", and the Scope field is marked required.
- It reads Microsoft's error code and, for missing consent or a refused scope, shows a specific sentence: the consent sentence in step 2 of Sign in as each person with Entra ID, or "The sign-in service refused the scope Studio asked for. Check the Scope: Microsoft Entra ID needs the API's full scope, for example <application ID>/.default or <Application ID URI>/access_as_user." When Microsoft refuses the person, Studio names why: "Your account is not assigned to this app in Microsoft Entra ID. Ask your Microsoft Entra administrator to assign you, or a group you are in, to the app.", "Your account is not in the Microsoft Entra directory this app belongs to. Sign in with an account from that organisation, or ask its administrator to invite you as a guest." or "Your organisation's access policy (Conditional Access) blocked this sign-in. Ask your Microsoft Entra administrator what it requires, for example a managed device." Any other refusal shows "The sign-in service refused the sign-in (error)." Microsoft's own description is never shown or stored, because it can carry account details.
- It accepts Entra's sign-in metadata, which lists no Proof Key for Code Exchange (PKCE) methods, and uses PKCE with S256.
- Set up the API, the Studio app (with a client secret, the delegated permission and admin consent) and the gateway's JWT authoriser as in steps 1 to 3 of Sign in as each person with Entra ID.
- In Studio, create an MCP Server connector with the gateway URL and set Sign-in method to Sign in with OAuth (each person).
- Set Client registration to Use a client registered with the provider: Entra does not let a product register itself. Enter the Studio app's Application (client) ID as Client ID, set Client authentication to Send in the request body, and enter the Client secret. Microsoft requires the secret for a Web redirect URI, which is the kind Studio uses.
- In Scope (optional), enter the full delegated scope, for example
api://<application-id>/access_as_user. Leave outoffline_access; Studio adds it. Leave Authorisation server (optional) blank: Studio reads it from the gateway. - Click Check sign-in. It shows "Sign-in service:
https://login.microsoftonline.com/<tenant-id>/v2.0" and "Studio will use the client registered with the provider." It also notes that Sign in with Microsoft (each person) is the recommended method for this server. Add the Redirect URI it shows to the Studio app's registration under Web, as in step 5 above. - Click Test connection ("Sign-in details found. Save the connector, then connect your account to list its tools."), then Create connector. Click Connect, sign in with your Microsoft account, click Test with my account, then list the tools and choose their access (Choose the tools agents may use).
Each person then clicks Connect with their own account. When Microsoft asks for a new sign-in on a later refresh, for example after a Conditional Access change, the connector shows Connect again, and the next Connect carries any extra requirement Microsoft named.
A connector that Studio 2.2.1 refused with "The sign-in service does not support the secure sign-in method Studio requires (PKCE with S256)." was not saved, so there is nothing to delete: after the update, follow steps 2 to 6.
Sign in with AWS IAM
Use this when the gateway's inbound authorisation is AWS IAM. Studio signs each request with AWS Signature Version 4, so you paste no secret.
- In Studio, create an MCP Server connector with the gateway URL and set Sign-in method to AWS IAM. Leave Region blank to read it from the gateway URL, and Signing service blank for
bedrock-agentcore. - Set Which role signs to Assume a role and enter the Role ARN of a role in the account that owns the gateway. You can enter the ARN before you create the role.
- Click Show Role setup. It shows the External ID (unique to this connector; required by the trust policy), the Trust policy (the role’s trust relationship) and an Example permission policy for the role.
- In AWS, set the role's trust relationship to that trust policy, so only this Studio can assume it and only with the External ID, and attach the permission policy. It allows the single action
bedrock-agentcore:InvokeGatewayon your gateway's ARN. - Click Test connection.
To sign with this Studio's own role instead, choose Use this Studio’s role. Show Role setup then gives This Studio’s role and an Example resource policy for the gateway that lets it invoke the gateway. This works only for an AgentCore Gateway URL.
Network access
On a deployment whose outbound traffic goes through AlphaAgent's NAT gateway, nothing needs opening. When it goes through your Transit Gateway and firewall, allow outbound HTTPS (443) from the Studio VPC to:
| Host | Needed for |
|---|---|
<gateway-id>.gateway.bedrock-agentcore.<region>.amazonaws.com, or your gateway's VPC endpoint | Every sign-in method: Studio calls the gateway from its VPC |
login.microsoftonline.com | Every Entra ID method: Studio gets and refreshes tokens from its own servers, not from the person's browser |
A gateway in another region than the deployment needs its own host entry, or a regional wildcard such as *.gateway.bedrock-agentcore.<region>.amazonaws.com. Assume a role calls AWS STS in the deployment's own region, which stays on AWS, so it needs no entry whichever region the gateway is in. The full allow-list is on Private network access.
Entra ID sees Studio's token requests coming from the deployment's egress address: the NAT gateway's Elastic IP address, or your firewall's public egress addresses (the Snowflake connector form shows the first as Deployment egress IP). If a Conditional Access policy limits sign-ins by location, include that address in the named location the policy trusts. Otherwise Microsoft refuses the refresh, the connector shows Connect again, and signing in again does not help.
What you should see
A Passed test, then Tools with every tool the gateway offers, from all its targets: Studio reads every page of the tool list, up to 100 pages. A gateway lists its tools without read-only marks, so each starts Approval required with Not marked read-only; set the access you want, then click Create connector (Choose the tools agents may use).
If the test fails
| You see | Check |
|---|---|
| "The token endpoint rejected the client ID or secret (error)." | The client ID, the secret and its expiry, and the tenant in the token URL. |
| "The server rejected the credentials (401). Check the client ID and secret, the scope, or the header values." | The gateway's discovery URL and allowed audiences match the token; the token is version 2.0 (requestedAccessTokenVersion is 2 on the API); the scope names your API in full, not a bare name that Microsoft reads as Microsoft Graph. |
| "The server accepted the credentials but refused access (403). Ask the server's owner to allow this identity." | For Entra ID, allowed clients is empty and allowed audiences is set, and any allowed scopes on the authoriser are ones the token carries. For AWS IAM, the permission policy allows bedrock-agentcore:InvokeGateway on this gateway. |
| "Studio could not assume the role role ARN (403). Check that its trust policy allows this Studio and requires the External ID shown in Role setup." | The role's trust policy is the one Role setup shows, with this connector's External ID. |
| "Your sign-in for this connector has expired or its settings changed. Connect your account again." | The person clicks Connect Microsoft account again. |
When the sign-in itself is refused, for a missing or refused Scope or missing consent, the sentences and what to do are in Sign in with OAuth (each person); the scope must exist on the API under Expose an API and be written with the Application ID URI.
Notes
- To rotate the client secret, open the connector, click Update, enter the new secret and save a new version; a blank field keeps the stored value.
- A connector downloaded from a Library arrives without its credential: add your own, or for an assumed role add this Studio's External ID to the role's trust policy (Data Bridge).
- If your organisation approves MCP servers by host, a gateway in each region needs its own entry, for example
*.gateway.bedrock-agentcore.eu-west-2.amazonaws.com(Connector policy).