Most enterprises that use Salesforce Agentforce also run Microsoft 365 and Microsoft Entra. Sooner or later an Agentforce agent needs something from the Microsoft side: a colleague’s profile, the user’s own mail, a file. The usual answer is a connected app with a client secret and broad Graph permissions, owned by nobody in particular. Nothing in Entra knows that an agent is calling, nobody can tell one agent from another in the sign-in logs, and switching the agent off means finding the secret.
Microsoft Entra Agent ID and Agent 365 are meant to fix that: every agent gets its own identity, with a sponsor, its own permissions, Conditional Access for agents, a kill switch and an audit trail. The question this article answers is whether an agent that runs inside Salesforce can have one, without moving it out of Salesforce.
It can. This article shows the complete path, built and tested end to end:
- Two Agentforce agents with their own Entra agent identities: one acts as itself (app-only), one acts on behalf of the signed-in user (OBO).
- No bridge service. Apex runs the Entra Agent ID token exchange in-process. The credential is a certificate whose private key never leaves Salesforce.
- Least privilege, with the defaults the tooling grants tightened afterwards.
- Telemetry from both agents sent to Agent 365, attributed to each agent identity.
- Registry sync, so the Agentforce agents are also listed in the Agent 365 registry through the Salesforce connected platform.
- No credential held in Entra at all, as an option: Salesforce becomes the federated issuer and Entra trusts its tokens through workload identity federation.
The focus is on the calls and the configuration, in the order they have to be made, and why.
Status of the APIs. Entra Agent ID, the Agent 365 CLI and SDKs, Agent 365 connected platforms, Conditional Access for agents and the Salesforce External Client App and Agent Script features used here were in preview or recently released when this was written (November–December 2026). Names, permissions, defaults and endpoints may change; check the current Microsoft and Salesforce documentation before relying on them.
Licensing and availability. Microsoft licensing for Agent 365, Entra Agent ID and Conditional Access for agents, and Salesforce licensing for Agentforce, change often, and some capabilities depend on preview enrolment. Nothing in this article is licensing advice. Confirm what your tenant and org need, and what is available to them, with your account teams before you plan or build.
Conventions
Values in angle brackets are placeholders: <tenant-id>, <blueprint-app-id>, <agent-identity-id>, <my-domain> (your Salesforce My Domain host, for example yourorg.my.salesforce.com) and so on. Nothing in this article is specific to one environment.
Constants published by Microsoft, the same in every tenant:
| Constant | Value |
|---|---|
| Token-exchange scope | api://AzureADTokenExchange/.default |
| Agent 365 observability API (scope) | api://9b975845-388f-4429-889e-eab1ef63949c/.default |
| Microsoft Graph (app-only scope) | https://graph.microsoft.com/.default |
The idea in one paragraph
An Entra agent identity is a child of an agent identity blueprint. The blueprint proves who it is with a credential, asks Entra for a short-lived exchange token for one of its agent identities (fmi_path), and the agent identity uses that exchange token to get the token it actually needs: as itself, or for a user. None of that requires the agent to run in Azure. Salesforce can store the blueprint’s certificate with a non-exportable private key, Apex can sign the client assertion with Crypto.signWithCertificate, and three HTTP calls later an Agentforce action holds a Microsoft Graph token issued to its own agent identity. Entra, Conditional Access, the sign-in logs and Agent 365 see the agent, not a shared app.
Two ways in: registry sync, or an identity of its own
Agent 365 offers two kinds of integration for a third-party platform, and they are not alternatives so much as layers.
| Registry sync (connected platform) | Own Entra agent identity (what most of this article builds) | |
|---|---|---|
| What it does | Agent 365 reads the list of Agentforce agents from Salesforce and shows them in its registry | Each Agentforce agent gets an Entra agent identity and uses it to call Microsoft APIs |
| Configured in | Agent 365 admin center + a Salesforce External Client App | Entra (blueprint, agent identity, grants) + Apex in Salesforce |
| Entra identity per agent | No | Yes, with sponsor, permissions and lifecycle |
| Conditional Access, kill switch, sign-in logs for the agent | No | Yes |
| Agent acts on behalf of a user in Microsoft 365 | No | Yes (OBO) |
| Telemetry attributed to the agent | No | Yes, sent by the agent with its own identity |
| Effort | Minutes | A day, the first time |
Registry sync gives inventory. An identity of its own gives control. I did both; the rest of the article is mostly about the second.
Why not a bridge?
My first build put a small Python “bridge” agent in Azure, registered with Agent 365, that forwarded requests to Agentforce. It worked, and it was the wrong shape: the identity, the permissions and the telemetry belonged to the bridge, a custom agent running in Azure, not to the Agentforce agent. The Agentforce agent itself was still anonymous to Entra. Moving the token exchange into Apex removed the bridge entirely and put the identity where the agent actually runs.
The moving parts
| Part | What it is |
|---|---|
| Agent identity blueprint (one per agent here) | Entra application of type agentIdentityBlueprint. Holds the credential; parent of the agent identity. |
| Agent identity | Service principal of type agentIdentity: who the agent is in Entra, Conditional Access and Agent 365. |
| Certificate in Salesforce | Self-signed, created in Certificate and Key Management, private key not exportable. Its public part is the blueprint’s key credential. |
EntraAgentIdTokenProvider (Apex) | Builds and signs the client assertion, runs the exchange, caches tokens per transaction. About 200 lines. |
Custom metadata Entra_Agent_Identity__mdt | Tenant, blueprint and agent identity IDs, certificate name and thumbprint, telemetry switch. One record per agent. |
| Invocable Apex actions | What the agents call: get a profile, read the user’s recent mail, explain how the agent authenticated. |
| Agentforce agents | Microsoft 365 Helper (autonomous, classic service agent) and Microsoft 365 Helper (OBO) (employee agent built with Agent Script). |
| Custom Auth. Provider (OBO only) | Links a Salesforce user to their Entra account and stores a user token audienced to the OBO blueprint. |
Agent365Telemetry (Apex) | Sends invoke_agent and execute_tool spans to the Agent 365 observability service with the agent’s own token. |
| Remote Site Settings | login.microsoftonline.com, graph.microsoft.com, agent365.svc.cloud.microsoft. |
The token flows
Show codeHide code
Salesforce (Apex) Microsoft Entra
1 blueprint sign RFC 7523 assertion with the Salesforce-held certificate (x5t header)
POST /token client_credentials, client_id=<blueprint-app-id>,
scope=api://AzureADTokenExchange/.default, fmi_path=<agent-identity-id> ─────▶ T1
2a autonomous POST /token client_credentials, client_id=<agent-identity-id>,
client_assertion=T1, scope=https://graph.microsoft.com/.default ─────▶ app-only token (roles)
2b on-behalf POST /token grant_type=jwt-bearer, requested_token_use=on_behalf_of,
client_id=<agent-identity-id>, client_assertion=T1,
assertion=<user token, aud = OBO blueprint>, scope=User.Read Mail.Read ─────▶ delegated token (scp, user)
3 telemetry POST /token as 2a, scope=api://9b975845-.../.default ─────▶ app-only token
POST agent365.svc.cloud.microsoft/.../agents/<agent-identity-id>/tracesStep 1 is the part that usually hides in an SDK or sidecar. fmi_path tells Entra which of the blueprint’s agent identities the exchange token is for; T1 is only usable as a client assertion by that one agent identity.
Prerequisites
- A Microsoft tenant with Entra Agent ID and Agent 365 available, and an administrator who can create blueprints, grant API permissions and consent (Application Administrator or Cloud Application Administrator plus Privileged Role Administrator, or Global Administrator in a lab).
- A Salesforce org with Agentforce. A Developer Edition org is enough to build everything here, including Agent Script employee agents. Registry sync needs a user with an Agentforce license to run as (more on that below).
- The Agent 365 CLI (
a365), the Azure CLI, and the Salesforce CLI (sf) with an API version that supports the metadata you deploy (Agent Script employee agents andagentAccessesin permission sets needed API 68). - A sponsor for each agent (a user).
Phase 1: Register the agents in Entra and Agent 365
1.1 Create a blueprint and agent identity per agent
I used the Agent 365 CLI, once per agent:
a365 setup all --agent-name "Salesforce Agentforce M365 Helper" # autonomous
a365 setup all --agent-name "Salesforce Agentforce M365 Helper OBO" --authmode obo
That creates the blueprint, its service principal, the agent identity, the registration in Agent 365 and a set of default permissions. Two things to know before you run it:
- It prints a client secret for the blueprint. Nothing in this design uses it. Delete it in Entra right away and scrub it from any file or log it landed in.
- It grants a broad default set of delegated permissions (mail, files, chat read/write and more) and sets
allAllowedinheritance from blueprint to agent identity. Phase 2 tightens both.
Run it in an interactive terminal: it stops at a consent prompt, and a non-interactive run cancels itself there.
1.2 Give the blueprint the Salesforce certificate
In Salesforce: Setup › Certificate and Key Management › Create Self-Signed Certificate, 2048-bit, Exportable Private Key unchecked. Download the public certificate (.crt).
In Entra, add it to the blueprint as a key credential. Entra wants the certificate’s SHA-1 thumbprint later, in the assertion’s x5t header, so compute it now:
# x5t = base64url(SHA-1 of the DER certificate)
openssl x509 -in entra_blueprint.crt -outform der | openssl dgst -sha1 -binary | basenc --base64url | tr -d '='
az rest --method PATCH \
--url "https://graph.microsoft.com/beta/applications/<blueprint-object-id>" \
--body '{"keyCredentials":[{"type":"AsymmetricX509Cert","usage":"Verify","key":"<base64 DER of the certificate>","displayName":"Salesforce Agentforce"}]}'
keyCredentials replaces the whole list, so include any credential you want to keep. The private key stays in Salesforce; there is nothing to rotate in Entra except the public certificate, before it expires.
Phase 2: Govern what each agent may do
This is where the two agents differ, and where the CLI defaults are too generous.
| Agent | Permission | Type | Where it is granted |
|---|---|---|---|
| Autonomous | Microsoft Graph User.Read.All | Application role | On the agent identity only |
| Autonomous blueprint | None | Default delegated grants and allAllowed inheritance removed | |
| OBO | Microsoft Graph User.Read, Mail.Read | Delegated, admin-consented | On the blueprint |
| OBO inheritance | enumerated: User.Read, Mail.Read | Inheritable permissions | Blueprint → agent identity |
Two gates apply to the OBO agent: what the blueprint may inherit to the agent identity, and what the user can see. The agent can never read mail the user can’t, and it can never use a scope outside the enumerated list, even if someone consents to more on the blueprint later.
Make these changes with a script an administrator runs, and read the result back after each change. I hit two traps doing exactly that in PowerShell: variable names are case-insensitive (a loop variable $g silently overwrote $G), and $ErrorActionPreference = 'Stop' does not stop on a failing native command such as az. Only the read-back caught both.
Re-running
a365 setup allcan restore the broad defaults. Re-check grants after every CLI run.
Phase 3: The token exchange in Apex
3.1 Configuration
One custom metadata record per agent:
| Field | Autonomous | OBO |
|---|---|---|
Tenant_Id__c | <tenant-id> | <tenant-id> |
Blueprint_App_Id__c | <blueprint-app-id> | <obo-blueprint-app-id> |
Agent_Identity_App_Id__c | <agent-identity-id> | <obo-agent-identity-id> |
Certificate_Name__c | unique name of the Salesforce certificate | same pattern |
Certificate_Thumbprint__c | the x5t value from 1.2 | |
Auth_Provider_Id__c | the Auth. Provider from Phase 5 | |
Telemetry_Enabled__c | true | true |
Plus Remote Site Settings for https://login.microsoftonline.com, https://graph.microsoft.com and https://agent365.svc.cloud.microsoft.
3.2 The client assertion
Show codeHide code
private String buildClientAssertion() {
Long now = Datetime.now().getTime() / 1000;
Map<String, Object> header = new Map<String, Object>{
'alg' => 'RS256', 'typ' => 'JWT', 'x5t' => cfg.Certificate_Thumbprint__c };
Map<String, Object> claims = new Map<String, Object>{
'aud' => tokenEndpoint(), // https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token
'iss' => cfg.Blueprint_App_Id__c,
'sub' => cfg.Blueprint_App_Id__c,
'jti' => UUID.randomUUID().toString(),
'nbf' => now - 30, 'iat' => now, 'exp' => now + 300 };
String signingInput = base64Url(Blob.valueOf(JSON.serialize(header)))
+ '.' + base64Url(Blob.valueOf(JSON.serialize(claims)));
Blob signature = Crypto.signWithCertificate('RSA-SHA256', Blob.valueOf(signingInput), cfg.Certificate_Name__c);
return signingInput + '.' + base64Url(signature);
}Crypto.signWithCertificate signs inside Salesforce; Apex never sees the private key.
3.3 Exchange token, then the token you need
Show codeHide code
// Step 1: blueprint -> T1 for its child agent identity
Map<String, Object> t1 = postToken(new Map<String, String>{
'client_id' => cfg.Blueprint_App_Id__c,
'scope' => 'api://AzureADTokenExchange/.default',
'fmi_path' => cfg.Agent_Identity_App_Id__c,
'client_assertion_type' => 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',
'client_assertion' => buildClientAssertion(),
'grant_type' => 'client_credentials' });
// Step 2a: autonomous, app-only
Map<String, Object> appOnly = postToken(new Map<String, String>{
'client_id' => cfg.Agent_Identity_App_Id__c,
'scope' => 'https://graph.microsoft.com/.default',
'client_assertion_type' => 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',
'client_assertion' => (String) t1.get('access_token'),
'grant_type' => 'client_credentials' });
// Step 2b: on behalf of the user (user token audienced to the blueprint)
Map<String, Object> delegated = postToken(new Map<String, String>{
'client_id' => cfg.Agent_Identity_App_Id__c,
'scope' => 'https://graph.microsoft.com/User.Read https://graph.microsoft.com/Mail.Read',
'client_assertion_type' => 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',
'client_assertion' => (String) t1.get('access_token'),
'grant_type' => 'urn:ietf:params:oauth:grant-type:jwt-bearer',
'assertion' => userAssertion,
'requested_token_use' => 'on_behalf_of' });The provider caches T1 and the final tokens for the rest of the Apex transaction (expiry minus two minutes), surfaces Entra’s AADSTS error codes, and never logs a request body or a token. A Signer interface lets unit tests replace the certificate signing; with the callouts mocked, the tests cover the assertion, both flows, the cache and the failure paths.
Phase 4: The agents
Microsoft 365 Helper (autonomous) is a classic Agentforce service agent with one topic and two actions (GenAiFunctions over invocable Apex): look up a colleague’s Microsoft 365 profile by email, and explain how the agent authenticates. It acts as itself, so anyone who can talk to it gets what the agent is allowed to see. That is the right model for directory lookups, and the wrong one for anyone’s mailbox.
Microsoft 365 Helper (OBO) is an Agentforce employee agent written in Agent Script. Its actions point straight at Apex:
Show codeHide code
config:
developer_name: "Microsoft_365_Helper_OBO"
agent_type: "AgentforceEmployeeAgent"
subagent my_microsoft_365:
actions:
get_my_recent_emails:
description: "Lists the signed-in user's most recent emails, read on behalf of the user."
target: "apex://MyM365MailAction"
inputs:
count: integer
is_required: FalseDeploy with sf agent publish authoring-bundle, then activate the new version explicitly (sf agent activate --version N): publishing creates a version but doesn’t activate it. Employee agents also need a permission set that grants the agent (agentAccesses), which needs metadata API 68.
Both agents also have an “explain my access” action. It decodes the Graph token the agent just used (claims only, never the token) and answers in plain language: token type, acting agent identity, the user it acts for, and the permissions in the token. It’s the most useful thing in the demo, because it turns an abstract identity design into a sentence the audience can read.
Phase 5: On-behalf-of: linking the user
The OBO flow needs a user token whose audience is the OBO blueprint (scope api://<obo-blueprint-app-id>/access_agent_as_user). Agentforce doesn’t have one, so each user links their Microsoft account once:
- A custom Auth. Provider plugin (
Auth.AuthProviderPluginClass) runs the authorization-code flow against Entra with a small sign-in app registration and requestsaccess_agent_as_useron the blueprint, plusoffline_access. - The user opens Settings › Connections in Salesforce and links their Microsoft account. Salesforce stores the tokens against that user.
- At action time,
Auth.AuthToken.getAccessToken(providerId, providerName)returns the user’s token. If it’s about to expire,Auth.AuthToken.refreshAccessTokenrefreshes it. If the user hasn’t linked, the action tells them how to.
A custom Auth. Provider stores tokens under its friendly name, not Open ID Connect; asking with the wrong provider name returns nothing.
If the user revokes the connection, the OBO agent stops working for that user and asks them to link again. That is the user consent boundary, and it makes a good demo.
Phase 6: Telemetry to Agent 365
There is no Agent 365 SDK for Apex, so Agent365Telemetry does what the SDK’s exporter does on its service-to-service route:
POST https://agent365.svc.cloud.microsoft/observabilityService/tenants/<tenant-id>/otlp/agents/<agent-identity-id>/traces?api-version=1
Authorization: Bearer <app-only token for the agent identity, scope api://9b975845-388f-4429-889e-eab1ef63949c/.default>
Body: OTLP JSON, one invoke_agent span with a child execute_tool span per action
I captured the payload shape from the SDK’s exporter and reproduced it. Telemetry is best effort: a failed export is logged and never breaks the agent’s action. The token is app-only for the agent identity in both agents, including the OBO one; telemetry is about the agent, not the user.
The service accepted the spans (HTTP 2xx). At the time of writing I had not yet seen them on the agents’ Activity tab in the admin center, so treat this part as “accepted by the service”, not “verified in the portal”.
Phase 7: Registry sync
Registry sync is configured in the Agent 365 admin center as a Salesforce connected platform. On the Salesforce side it needs an External Client App with the client credentials flow, and a Run As user whose permissions decide what the sync can see.
This took longer than everything else. The connection logged in successfully every time and still returned “Permission denied” (ConnectedPlatformUnauthorizedAcess) on sync. I tried a Salesforce Integration user, then a full-license user with View Setup, agent access and broad read permissions, then the Agentforce and Data Cloud permission sets. All failed the same way. The permission set that looked right couldn’t even be assigned: the org’s only Agentforce (Default) permission set license was already in use. With the admin (who holds that license) as Run As, the sync was healthy and listed both agents.
The takeaway: the Run As user needs an Agentforce license, not just permissions. In a Developer Edition org that usually means the admin; in production, buy a license for a dedicated integration user rather than running sync as an administrator. Also, I didn’t find an observability option in the connection settings; telemetry comes from the agents themselves (Phase 6).
Going further: no credential in Entra at all (Salesforce as the federated issuer)
The certificate design keeps the private key in Salesforce, but Entra still holds a credential: the public key. Workload identity federation removes even that. Instead of a certificate assertion, the blueprint presents a token signed by Salesforce, and Entra trusts Salesforce as an external OpenID Connect issuer through a federated identity credential (FIC) on the blueprint.
How it works
Show codeHide code
1 Apex signs a JWT bearer assertion with the app's certificate and posts it to https://<my-domain>/services/oauth2/token
→ Salesforce JWT access token for a dedicated integration user
header {"alg":"RS256","kid":"CORE_ATJWT.<org-id>.…","tty":"sfdc-core-token"}
claims {"iss":"https://<my-domain>","aud":["https://<my-domain>"],"sub":"uid:<18-char user id>","scp":"api", …}
2 POST Entra /token client_credentials, client_id=<blueprint-app-id>, fmi_path=<agent-identity-id>,
scope=api://AzureADTokenExchange/.default, client_assertion=<Salesforce JWT> → T1
(Entra checks iss/sub/aud against the FIC and validates the signature with keys from https://<my-domain>/id/keys)
3 T1 → agent identity app-only Graph token → Microsoft Graph (exactly as in Phase 3)Configuration
Salesforce:
- A dedicated integration user (Salesforce Integration license, API-only profile, no data access). Its 18-character user Id becomes the token subject,
uid:<user-id>. - A permission set with no permissions, assigned only to that user. The External Client App is pre-authorized for this permission set and nothing else.
- A separate self-signed certificate for the app, not the blueprint’s, with a non-exportable key.
- An External Client App with the JWT bearer flow (that certificate), Issue JWT-based access tokens for named users on, scopes
apiandrefresh_token, client credentials off, and Admin approved users are pre-authorized for the permission set above. In metadata, the policy file carries<permittedUsersPolicyType>AdminApprovedPreAuthorized</permittedUsersPolicyType>and<commaSeparatedPermissionSet>…</commaSeparatedPermissionSet>. - A Remote Site Setting for your own My Domain, because Apex calls the org’s own token endpoint.
Check that Entra will be able to validate the token: https://<my-domain>/.well-known/openid-configuration must return your My Domain as issuer, and its jwks_uri (/id/keys) must list the CORE_ATJWT.* key id from the token header.
Entra:
Show codeHide code
POST https://graph.microsoft.com/beta/applications/<blueprint-object-id>/federatedIdentityCredentials
{
"name": "salesforce-wif",
"issuer": "https://<my-domain>",
"subject": "uid:<integration-user-id>",
"audiences": ["https://<my-domain>"]
}Test results
| Test | Result |
|---|---|
| Integration user + app certificate, FIC present | 200 at all four steps; the Graph token was app-only for the agent identity, with the blueprint as its parent (xms_par_app_azp) |
| Same request, FIC removed | 401 AADSTS70025: the blueprint has no configured federated identity credentials |
| Administrator as the JWT subject | 400 invalid_app_access: user is not admin approved to access this app |
| Blueprint certificate instead of the app’s certificate | 400 invalid_client |
Should you use it?
It works, and it removes the last credential from Entra. Before you make it the default, weigh three things:
- The FIC matches only issuer, subject and audience. Entra can’t check which Salesforce app issued the token, so any Salesforce JWT access token for the subject user is accepted. That is why the subject must be a dedicated user that only this app can issue tokens for, never an administrator.
- Salesforce access tokens live much longer than a five-minute client assertion: hours, set by the session timeout. Mint a fresh one for every exchange and never store it.
- One key per trust. Don’t reuse the blueprint’s certificate for the Salesforce app. If one key leaks, the other trust should survive.
In my build the certificate flow stays the default and the FIC is added only for demos, then removed.
Proving it: the demo
| Step | What to do | What the audience sees |
|---|---|---|
| Autonomous identity | Ask the Microsoft 365 Helper: “How do you authenticate to Microsoft 365?” | App-only token, acting agent identity by name, on behalf of nobody, application role User Read All |
| Delegated identity | Ask the OBO agent: “How do you access my Microsoft 365 data?” | Delegated token for this user and this agent, limited to User Read and Mail Read |
| Least privilege | Ask the OBO agent for someone else’s mail | It can’t: it only ever sees the user’s own mailbox |
| Proof in Entra | Sign-in logs, agent sign-ins | Certificate sign-ins by each agent identity; OBO sign-ins on behalf of the user |
| Kill switch | Set the agent identity’s accountEnabled to false, ask again | AADSTS7000112 … is disabled. Re-enable and it works again within seconds |
| Consent boundary | The user revokes the connection in Salesforce, asks the OBO agent | The agent asks them to link their Microsoft account |
The kill switch is the moment that lands with security teams. The agent runs in Salesforce; it is switched off in Entra.
How to know it worked
Decode the tokens (claims only) and check:
| Token | Claim | Expect |
|---|---|---|
| Autonomous Graph token | idtyp | app |
appid / azp | <agent-identity-id>, not the blueprint | |
roles | ["User.Read.All"] and nothing else | |
xms_par_app_azp | <blueprint-app-id> | |
| OBO Graph token | scp | User.Read Mail.Read |
azp | <obo-agent-identity-id> | |
upn / oid | the signed-in user | |
| Telemetry token | aud | the Agent 365 observability API |
Lessons learned
Entra and Agent 365
a365 setup allgrants broad default delegated permissions andallAllowedinheritance. Tighten both afterwards, and re-check after every CLI run.- The CLI prints the blueprint’s client secret in plain text. If you don’t use it, delete it and scrub it from logs.
- Run the CLI interactively; a non-interactive run cancels itself at the consent prompt.
- Make admin changes with scripts an administrator runs, and confirm each one by reading the state back.
- Disabling the agent identity blocks it immediately (
AADSTS7000112), and re-enabling restores it within seconds. That makes a reliable, reversible governance demo.
Salesforce and Agentforce
- The certificate must be created in the org that runs the code. Check Setup › View Setup Audit Trail if a “missing certificate” error makes no sense: mine had been created in another org.
.forceignorepatterns that hide certificates or agent metadata from source tracking also hide them fromsf agent publish. A bundle that publishes fine but loads as Invalid Config may simply not have been included.- Every Agent Script action needs a named, typed input, even an optional one. An action whose only input was a bare
List<String>published without a schema and broke the agent. sf agent createproduced a service agent; employee agents came from Agent Script withagent_type: "AgentforceEmployeeAgent".sf agent publishcreates a version but doesn’t activate it. Activate explicitly.- The Agent Script router needs examples. “How do you access my Microsoft 365 data?” went to Off Topic until the router’s instructions listed authentication questions.
- The Einstein Trust Layer masks dotted names such as
Mail.ReadasURL_Redactedin agent answers. Present scopes as “Mail Read”. Auth.IntegratingAppTypevalues areECAandCA, andexportis a reserved word in Apex.
Registry sync
- Login success tells you nothing about sync. Permission denied with a working login means the Run As user lacks what the sync needs; in my case, an Agentforce license.
Workload identity federation
- Salesforce issues opaque access tokens by default; only JWT-based access tokens for named users give Entra something to validate.
- The JWT bearer flow on an External Client App fails with “refresh_token scope is required and the connected app should be installed and preauthorized” until the
refresh_tokenscope is added and users are pre-authorized. - In the Salesforce token,
issandaudare both the My Domain URL andsubisuid:<user id>, not the username. Entra accepted the My Domain URL as the FIC audience;api://AzureADTokenExchangewasn’t required. - Self-signed certificates can’t be created with metadata. Create them in Setup and retrieve only the public part.
- On Windows,
az restbreaks on parentheses in Graph URLs such asapplications(appId='…'). Look up the object Id first. - The FIC took effect within seconds, and the certificate credential and the FIC coexisted on one blueprint without affecting the running agents.
Common problems
| Symptom | Likely cause | Fix |
|---|---|---|
AADSTS700027 / invalid client assertion at step 1 | x5t doesn’t match the certificate uploaded to the blueprint, or the assertion aud isn’t the token endpoint | Recompute the thumbprint from the same .crt; use https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token |
AADSTS82001 | Asking for an app-only token as the blueprint | Request tokens as the agent identity, with T1 |
| OBO fails: “account isn’t linked” | The user hasn’t linked, or the code asks for the token with the wrong provider name | Settings › Connections; use the Auth. Provider’s friendly name |
AADSTS65001 on OBO | Scope not consented on the blueprint, or not in the enumerated inheritance list | Consent on the blueprint and add it to inheritable permissions |
AADSTS7000112 | Agent identity disabled | Intended, if you pulled the kill switch |
| Agent loads as Invalid Config | Bundle excluded by .forceignore, or an action without a typed input | Fix the ignore file or the action and publish again |
| Registry sync: Permission denied, login OK | Run As user without an Agentforce license | Assign one, or run as a licensed user |
AADSTS70025 (WIF) | No FIC on the blueprint | Add it |
AADSTS70021 (WIF) | Issuer, subject or audience differs from the FIC | Compare the Salesforce token’s iss/sub/aud with the FIC |
What this gives you
- Agentforce agents with their own Entra agent identities, sponsors and owners, registered in Agent 365, and listed there by registry sync too.
- No bridge and no secret: the private key never leaves Salesforce, and with federation Entra holds no credential at all.
- An agent that acts as itself with one application role, and an agent that acts for the user with two delegated scopes, never more than the user can see.
- Entra-side control of agents that run in Salesforce: Conditional Access for agents, sign-in logs, and a kill switch that works in seconds.
- Telemetry sent by each agent under its own identity.
The agent stays where the business logic and the data are. The identity, the permissions and the off switch live where the security team already works.
¶ Discussion
Comments are powered by Giscus / GitHub Discussions. They appear here once configured — see
Configure Giscusin the project README and updateGISCUSinsrc/consts.ts.