Right now I'm using AAD app to make Service A => Service B calls. This includes:
- AAD app
- KeyVault which keeps a secret/certificate for AAD app
- Managed Identity with access to KeyVault
The flow looks like this:
- Service A: Get token from Managed Identity
- Service A: Go to KeyVault, present a token and get a secret for AAD app
- Service A: Go to AAD, present a secret and request a token for a particular resource
- Service A: Make a call to Service B
- Service B: Validate a token and a resource
I wonder whether it is possible to register a managed identity with my service, so if a Managed Identity token is presented then Service B can trust Service A. Something like this:
- Service A: Get token from Managed Identity
- Service A: Make a call to Service B
- Service B: Validate that token comes from registered Managed Identity
Is it feasible? Does it violate any security best practices?
Update: beside below answer, the following stack overflow post describes how to make Managed Identity in one tenant to get a role claim for an app in another tenant
Grant service principal access to application in other tenant