Author: Abhijit Nawale
Overview
This article will cover the Get Secret operation of key vault connector.
Introduction
The Azure Key Vault stores and protects the secrets (such as credentials), certificates (and the private keys linked to the certificates), and cryptographic keys in the cloud.
Register a client application in the azure active directory:
To access the key vault using a mule connector, first, you have to register the application in Azure App registrations and grant access to the azure key vault via API permissions.
You can follow Microsoft documentation to register the application.
Authorize the Azure AD app into the key vault:
After registering the app, we must add the service principal to the key vault’s access policies.
To do so, choose the key vault, click on the Access Policies-> Add Access Policy->
Select Key, Secret & Certificate Management from the dropdown menu->then click on the noon select the link for the select principal and search for your registered app and click the button select and then the Add and Save button.

Azure Key Vault Connector Studio Configuration:
Add Connector to Your Project Using Exchange
- Create a sample mule project
- Click the search in Exchange icon from the mule palette
- Search Azure key vault and add it to the module .

- The azure connector can be seen after adding the module to the palette.

- Also, you can directly add the dependencies to your pom.xml.
<dependency>
<groupId>com.mulesoft.connectors</groupId>
<artifactId>mule4-azure-keyvault-connector</artifactId>
<version>1.0.1</version>
<classifier>mule-plugin</classifier>
</dependency>
Connector Configuration:
- Client Id: This is your registered app’s Application (client) Id.
- Tenant Id: Your registered app’s director (tenant) ID.
- Client Secret: You can find this value in the Register app-> Certificate and secrets->value.
- Vault Name: This is the name of the Key vault.
- Secret Name: A secret name from the key vault whose value you want to retrieve.

Mule Flow:

Output:
{
"name": "{SECRET-NAME}",
"expiresOn": null,
"id": "https://{KEY-VAULT-NAME}.vault.azure.net/secrets/{SECRET-NAME}/72c13456543c45f7a38a4f29d790146e",
"value": "{SECRET-VALUE}",
"contentType": null
}