Retrieve Key Vault secrets in Logic App
1. Retrieve Key Vault secrets in Logic App
Welcome back! In the last exercise, we created a Key Vault and stored a secret in it. Now, let’s see how we can access that secret from a Logic App using a simple automated flow. We’re using this Logic App to demonstrate the idea. To fetch the secret, the Logic App first needs permission to access the Key Vault. To do that, we’ll enable something called a System Assigned Managed Identity. We haven’t covered Managed Identities yet but we’ll get to that soon. For now, just understand it allows the Logic App to securely authenticate to Azure services without storing credentials. Let’s head over to the Identity section of the Logic App. We’ll enable System Assigned Identity and grab the Object ID, this is like the app’s identity card. Next, in the Key Vault’s Access Policies, we’ll create a new policy to allow secret access. Under permissions, we’ll grant Get and other secret-related permissions. Then, paste in the Object ID we just copied as the principal. Finish by adding and saving the policy. That’s it for the setup! Now let’s build the Logic App flow. First, we’ll use the trigger When an HTTP request is received. This lets us run the app on demand. Next, insert the action Get Secret from Azure Key Vault. And here’s the cool part the secret we created earlier is already showing up! That’s because we just connected the Logic App’s identity with the Key Vault. Let’s make one quick change. We’ll disable Secure Inputs and Secure Outputs so we can see the secret value during this demo. In real apps, these should stay on for security. Now we’ll save the Logic App, run it, and check the run history. And there it is, the secret value has been fetched successfully from the Key Vault. So that’s how you securely pull secrets from Azure Key Vault into a Logic App using Managed Identity.2. Let's practice!
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.