Here is an end to end example of Azure API Management and Azure Key Vault, including how to setup authorization in Azure AD so APIM can read secrets, certificates, etc. from Key Vault.
https://github.com/kevinhillinger/azure-api-management-keyvault
The integration requires that a service principal is registered in the Azure AD tenant for the subscription that the Key Vault instance belongs to. Then we're going to authorize it to talk to key vault.
In the example provided, I am retrieving a certificate since this is the more "difficult" option.
Here is the flow for the integration of Azure Key Vault:
- Get a minted token (bearer) from Azure AD (make sure the scope is properly set for Key Vault)
- Get the response and set a variable with the token value
- Send a request to Key Vault with Authorization header loaded up with the token
- Get the certificate info
- Fetch the entire PFX file in base64