On December 18th, Microsoft announced the release of the use of Managed Identities as Federated Identity Credentials for Microsoft Entra. This change greatly improves security in scenarios where you must create your app registration and connect to it in the app-only context, which was previously only possible with a Client Secret or Certificate. Both of which are subject to being stolen.
The idea behind federating your app registration with a managed identity is to enable Azure resources to connect to your application without the need for credentials, securely. This is great, but if you are accessing resources protected by Microsoft Entra in your own tenant, then you are likely better off skipping the app registration part and just using a managed identity.
While this is true in most cases, there is one standout scenario where your app registration is required, which is when creating a multi-tenant application to facilitate access to other Microsoft 365 tenants. Multi-tenant apps are useful as they enable you to share resources across multiple tenants saving cost and they enable you to scale efficiently with a simple onboarding of new tenants. However, in my scenario, I can use a multi-tenant app registration to deliver a service to a customer whereby I can provide support and/or services to their tenant securely. The core problem is that before this announcement, I would still have had to store and maintain a client secret or certificate to facilitate this access.
So how can I configure my app registration to trust a managed identity?
The process of creating federated credentials via a managed identity for your application is quite simple, the below steps summarise the process:
- Create a user-assigned managed identity in Microsoft Azure (these are free).
- Create a new multi-tenant app registration in Microsoft Entra (or use an existing app registration) and consent to your required permissions.
- Add a new federated credential to your app registration and select your managed identity.
- Configure your application to request an access token via the managed identity.
The outcome is that you are then able to manage workloads within other tenants that have consented to your application, via the Azure resource that is assigned the managed identity. The process (known as Workload Identity Federation) works by letting the app/resource exchange the managed identity token for an access token that can access resources protected by Microsoft Entra, either in your own or another Microsoft tenant. The flow of how these access tokens are exchanged is highlighted in the below image created by the Microsoft Entra Identity dev team.
Utilising your app for multi-tenant access
While Microsoft has provided code examples for developers to request access tokens from your federated managed identity, mainstream support has not yet been released for user-friends SDKs such as the Microsoft Graph PowerShell module.
So far, examples have been provided for various identity libraries such as Azure.Identity, Microsoft.Identity.Web and MSAL (.NET). I have reached out to the PowerShell product team for further comment on support in Graph or Entra PowerShell. Keep an eye on our blog for an upcoming blog on how to use Managed Identities for multi-tenant access using Azure Automation.

