Call Endpoint / restAPI from App with service account?

I have some endpoints / rest API that I don’t want my users to run outside of the dashboard.
Is it possible to call it within the dashboard? I’m running PSU with a service account.

I too have been wondering about this. I call many of my API endpoints internally from within apps or even other endpoints.

I haven’t quite figured out any way to make them work without just disabling authentication on the endpoints. Is there a way to “pass through” the identity / context of the app to the API call?

You can pass the current logged in user with -Header $Headers for the invoke-rest method
But that only brings the information regarding the current logged in user.

What I want is to bring the service account user or do something like -Integrated for the Invoke-RestMethod so even that the current logged in user don’t have permissions for the RestAPI it would still work to execute for him as he push a button in the dashboard.

@adam is this possible?