APIM connection to KV via Managed Identity fails

Marcelo Silva 30 Reputation points Microsoft Employee
2023-02-11T14:37:02.0733333+00:00

I'm following the setup described here: https://learn.microsoft.com/en-us/azure/api-management/api-management-howto-properties?WT.mc_id=Portal-fx&tabs=azure-cli

I setup APIM with a system managed identity, then go to KV, grant Key Vault Secrets user to the APIM identity, but when I try to set a named value to a secret in KV I get this error:

"Failed to create named value: One or more fields contain incorrect values:
System-Assigned Managed Identity is required to access keyvault secret, which is not enabled. For more information please see aka.ms/apimmsi."

However, it does not make any sense.

Any help appreciated.

Azure Key Vault
Azure Key Vault
An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
1,314 questions
Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,175 questions
0 comments No comments
{count} vote

Accepted answer
  1. Marilee Turscak-MSFT 36,866 Reputation points Microsoft Employee
    2023-02-15T00:13:25.2233333+00:00

    Hi Marcelo Silva ,

    The error typically means that the System Assigned Managed Identity is not enabled to access key vault secret. I've also seen some temporary issues that have caused this error to get thrown, so please try these steps:

    1.) Please confirm that you have enabled the System Assigned Managed Identity.

    2.) If it is already enabled, please disable and enable the managed identity from the portal to confirm it works. If you set the Status to "Off" and hit "Save", and then set it to "On" again and hit "Save" again, you may see the error disappear.

    User's image

    The error can sometimes be misleading though and I have also seen some cases where this happens when there is a firewall blocking the access, or if the named value exceeds the 4096 limit.
    If the steps I suggested don't work, feel free to reach out to me on Teams if you would like to troubleshoot further.

    -

    If the information helped you, please Accept the answer. This will help us and improve searchability in the community for others who are researching similar issues.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.