Managed Identity Authentication
  • 05 Feb 2021
  • 1 Minute To Read
  • Contributors
  • Print
  • Comments
  • Share
  • Dark
    Light

Managed Identity Authentication

  • Print
  • Comments
  • Share
  • Dark
    Light

#ServerlessTips - API Management
Author: Hussein Awad, Senior Cloud Application Architect

This article explains how to create an Azure Active Directory (AD) managed identity for an Azure API Management instance and how to securely access other Azure AD-protected resources, such as Azure Function App. Using Azure AD manages this identity, so you don't have to pass passwords between resources or rotate secrets.

  1. Go to your API Management Instance -> Managed Identities -> System Assigned (as shown in the screenshot).
    image.png
  2. Turn the Status “On” and then save your changes.
    image.png
  3. Then, browse the Azure resource you want to set the Managed Identity Authentication with the API Management. In this case, our resource is an Azure Function App. Then browse to “Authentication & Authorization” as shown in the figure.
    image.png
  4. Turn “App Service Authentication” On.
  5. Open “Action to take when the request is not authenticated” dropdown, and select “Login with Azure Active Directory” as shown in the picture below:
    image.png
  6. In the Authentication Providers, select “Azure Active Directory”, and you should find it as “not configured” as shown in the picture.
    image.png
  7. Select “Express” Management Mode, then "Create New AD App” from the second Management Mode. Then add a name for your App as shown in the picture below:
    image.png
  8. Go ahead and save your changes.
    image.png
  9. Go back to your API Management instance, then go to APIs, and select your API / Operation for which you want to set up the Managed Identity Authentication.
    image.png
  10. Put this policy in the inbound policies.
<authentication-managed-identity resource=”” />
  1. Go to your Azure Function App and copy the URL. Put it in the resource of the above policy.
    image.png
  2. By now your policy should look like the picture below.
    image.png
  3. For validation, go to the test tab in your API Management and send a test request to your API. Then go to the “trace” tab. You should see that Managed Identity authentication has taken place.
    image.png
  4. Search for "Managed-identity" in your trace to validate it has been applied.
    image.png
Was This Article Helpful?