I could be completely off basis here on how this works, but this is what I'm looking to achieve.
In AAD I have
- an App Registration called
backend-api
that represents an HTTP API - an App Registration called
frontend-app
that represents some client (lets say a console app) - an App Registration called
another-app
that represents nothing related to my solution
I have a console application where I put my client ID and client secret in for frontend-app
and I can request an access_token
with the aud
of backend-api
. This is great, exactly what I want. However, I can litterally do the same thing from another-app
if I have the client ID and client secret for that app. What I would like to accomplish is that only frontend-app
is allowed to get an access_token
for backend-api
.
I'm not quite sure how to go about configuring that specific requirement. I thought maybe I needed to add an appRoles
entry for allowedMemberTypes
Application
on backend-api
and then grant frontend-app
that role but that didn't apply any restriction to another-app
. Likewise I thought maybe backend-api
needed to have it's "Require User Signin" option checked under Enterprise Applications, but I couldn't find a way to add frontend-app
as a "user" -- probably the wrong direction anyhow.
What's the way to tell AAD to only hand out access_tokens
for backend-api
(aud
claim) if they are being requested via frontend-app
only? Maybe that's a silly question, and it just doesn't work this way?