Hi Clive,
Thank you for a very useful series of posts on this subject.
I tried this, and came across the issue due to case-sensitive comparison on Subject of Federated Identity.
The error thrown was:
No matching federated identity record found for presented assertion subject 'component:pluginassembly,thumbprint:14F142E1A8FEB3876C4CF401024B736F4A1F1254,environment:<<EnvironmentId>>'
Carefully noticing, i found out that the thumbprint passed to verify claims had all alphas as uppercase, though i had copied that from my self-signed certificate as such.
Secondly in your post here , in step 2, the issuer uri has a type-o in "enviorment", i copy/pasted :)
https://[environment ID prefix].[environment ID suffix].enviornment.api.powerplatform.com/sts
... as i kept getting error, upon carefully looking at the issuer in my managed identity federated credentials, i spotted and fixed it
https://[environment ID prefix].[environment ID suffix].environment.api.powerplatform.com/sts
Thanks
Ameed