I'm trying to call an Azure function from an API Management instance by using Managed Identity. I have set a System Managed Identity to my APIM instance. I have granted the Contributor role to this identity on the Azure Function App. I have also change the App Service Authentication to AD.
Now I'm trying to call the function from an API.
I have two issues:
- First One: when I use the authentication-managed-identity policy to get a token, I got an error when I use the audience https://myfunctionapp.azurewebsites.net. AD tells me that this app is not registered in the tenant
- Second: If I retrieve a token for https://management.azure.com, I got a token but I received a 401 Unauthorized error from the Azure Function.
Maybe I'm just trying to get a token on the wrong audience, but unfortunately the audience of functions is not listed in the document (for service bus for example, there is a common URI to use, also for KeyVault, ...).
I think that I probably missed something in the picture... Thanks.