Search code examples
azureazure-active-directory

As an owner, impersonate Azure Service Principal


I'm the owner (with my human account) of an Application Registration and I'd like to impersonate its Service Principal. How can I achieve that? I wasn't able to find any docs on this.


Solution

  • You cannot "impersonate" a service principal. What you need is authenticating to the API you want to access using the application's credentials.

    This is done using the OAuth client credentials flow (one HTTP request): https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow.

    More info on this scenario: https://learn.microsoft.com/en-us/azure/active-directory/develop/scenario-daemon-overview.