D365 F&O On-Premises: Local Agent cannot connect to LCS – AADSTS700027 “The certificate … is not registered on application”
Hi everyone,
If you run Dynamics 365 Finance and Operations on-premises (LBD), you know the Local Agent is the link between your Service Fabric cluster and LCS. When it can’t authenticate, nothing works: no deployments, no servicing, no package preparation. In LCS, the environment simply sits there and Message agent fails.
I hit AADSTS700027 on a production environment recently: the Local Agent could not connect to LCS just after its certificate had been renewed. The fix took five minutes, but finding it took longer than it should have. Here is the full story, so it saves you some time.
The symptoms
- LCS shows the Local Agent as not responding; Message agent fails.
- The orchestrator VMs have internet access (
Test-NetConnectionto the LCS endpoints on port 443 is fine). - The Local Agent services are running in Service Fabric and the cluster is healthy.
The real error is on the orchestrator nodes, in Event Viewer → Applications and Services Logs → Microsoft → Dynamics → AX-LocalAgent → Operational:

Unable to get queue information from LCS | MSAL.Desktop.4.57.0.0.MsalServiceException:
ErrorCode: invalid_client
Microsoft.Identity.Client.MsalServiceException: A configuration issue is preventing authentication
...
AADSTS700027: The certificate with identifier used to sign the client assertion is not registered on
application. [Reason - The key was not found., Thumbprint of key used by client: ...]
What the error means
The Local Agent signs in to Entra ID (Azure AD) as an app registration, using a certificate instead of a password. The thumbprint of that certificate is servicePrincipalThumbprint in localagent-config.json, and the certificate itself sits in LocalMachine\My on every orchestrator node.
For the sign-in to work, the public key of that same certificate must be uploaded to the app registration in Entra ID. AADSTS700027 means Entra received a request signed with a certificate it doesn’t know. In plain words: the certificate on the server and the certificate on the app registration are not the same.
Root cause in my case
The old Local Agent certificate had expired. A new one was issued and installed on the orchestrator nodes, and the Local Agent was reinstalled with the new thumbprint in localagent-config.json. All fine on the server side.
But the app registration in Entra ID was never updated. It still had only the expired certificate:

Important point: LocalAgentCLI.exe install does not touch Entra ID at all. It deploys the Local Agent application into Service Fabric with the config you give it. Registering the certificate on the app registration is a separate step. When you renew certificates, this is the step people forget.
If you manage more than one on-premises environment (TEST and LIVE, for example), check that each environment’s app registration has its own current certificate. Rotating the certificate for one environment does not update the other.
How to confirm
- On an orchestrator node, open
localagent-config.jsonand noteservicePrincipalThumbprintandappId. - Check that the certificate exists on the node and has its private key:
$thumb = "<servicePrincipalThumbprint>" Get-ChildItem Cert:\LocalMachine\My\$thumb | Select-Object Subject, Thumbprint, NotAfter, HasPrivateKey - In the Azure portal: Microsoft Entra ID → App registrations → All applications, search for the
appId, then open Certificates & secrets → Certificates. - If the thumbprint from step 1 is not in the list, you have found your problem.
The fix
1. Export the public key (.cer) from an orchestrator node
$thumb = "<servicePrincipalThumbprint>"
$cert = Get-ChildItem Cert:\LocalMachine\My\$thumb
New-Item -ItemType Directory -Path C:\Temp -Force | Out-Null
Export-Certificate -Cert $cert -FilePath "C:\Temp\LocalAgent-$($thumb.Substring(0,8)).cer"
This exports only the public key. Never upload the .pfx; Entra only needs the .cer.
2. Upload it to the app registration
In the Azure portal, open the app registration → Certificates & secrets → Certificates → Upload certificate, select the .cer file and click Add.

Uploading adds a certificate; it does not replace the existing ones. That’s why this is safe to do on a production environment: nothing else that uses the app is affected.
3. Wait a few minutes and validate
Give Entra a few minutes to propagate the change. The Local Agent retries on its own; you don’t need to reinstall it or restart anything. Then in LCS, open the environment and run Message agent / Validate setup. In my case it went green within minutes, and the AADSTS700027 events stopped.
4. Clean up
Once everything is confirmed working, delete the expired certificate from the app registration, so the next person who looks at it doesn’t get confused.
Tips to avoid this next time
- Track the expiry date of the Local Agent certificate (and of all the LBD certificates) somewhere visible. When it expires, everything stops at once.
- When you renew it, the checklist is: install the certificate on all orchestrator nodes → update
localagent-config.json→ reinstall the Local Agent → upload the .cer to the Entra app registration. - When LCS cannot reach the agent, go straight to the AX-LocalAgent → Operational log on every orchestrator node. The message in LCS rarely tells you the real cause.
Reference: Set up and deploy on-premises environments – Microsoft Learn
I hope this helps someone. If you have questions, drop them in the comments.
Related: Unable to download asset … The job state is failed (Part 2): The network name cannot be found