Azure Key Vault Variable Resolver
Description
The Azure Key Vault Variable Resolver allows you to retrieve secrets from Microsoft Azure Key Vault and use them as variables in your Apache Hop pipelines and workflows. This integration enables secure management of sensitive information such as database credentials, API keys, and other secrets by fetching them directly from Azure Key Vault.
Configuration Options
Azure Key Vault URI
The full URI of your Azure Key Vault. This should be in the format https://your-vault-name.vault.azure.net/
.
Azure Tenant ID
The Directory (tenant) ID of your Azure Active Directory. This is a GUID that identifies your Azure AD tenant.
You can find this in the Azure Portal under Azure Active Directory → Overview → Tenant ID.
Azure Client ID
The Application (client) ID of your service principal or registered application. This is the identity that will authenticate with Azure Key Vault.
You can find this in the Azure Portal under Azure Active Directory → App registrations → Your Application → Application (client) ID.
Azure Client Secret
The client secret (password) for your service principal or registered application. This is used to authenticate your application with Azure AD.
You can create a client secret in the Azure Portal under Azure Active Directory → App registrations → Your Application → Certificates & secrets.
Keep your client secret secure! Never commit it to source control or share it publicly. The Azure Key Vault Variable Resolver is designed to help you avoid hardcoding such secrets. |
Setting Up Azure Key Vault
Prerequisites
-
An active Azure subscription
-
Appropriate permissions to create Azure resources
-
Azure CLI installed (optional, but recommended)
Step 1: Create an Azure Key Vault
Using the Azure Portal:
-
Navigate to the Azure Portal
-
Click Create a resource → Search for Key Vault
-
Click Create
-
Fill in the required information:
-
Subscription: Select your Azure subscription
-
Resource Group: Create a new one or select an existing resource group
-
Key Vault Name: Enter a unique name (e.g.,
my-company-hop-vault
) -
Region: Select the region closest to your Hop installation
-
Pricing Tier: Standard (or Premium if you need HSM-backed keys)
-
-
Review the networking and access policy settings (default is fine for most use cases)
-
Click Review + Create → Create
Using Azure CLI:
# Create a resource group (if you don't have one)
az group create --name hop-resources --location eastus
# Create the Key Vault
az keyvault create \
--name my-company-hop-vault \
--resource-group hop-resources \
--location eastus
Step 2: Create a Service Principal
A service principal is an identity that your Hop application will use to authenticate with Azure.
Using Azure Portal:
-
Go to Azure Active Directory → App registrations
-
Click New registration
-
Enter a name (e.g.,
hop-key-vault-app
) -
Select Accounts in this organizational directory only
-
Click Register
-
Note down the Application (client) ID and Directory (tenant) ID
-
Go to Certificates & secrets → New client secret
-
Add a description and expiration period
-
Click Add and immediately copy the Value (you won’t be able to see it again!)
Using Azure CLI:
# Create a service principal
az ad sp create-for-rbac \
--name hop-key-vault-app \
--skip-assignment
# Note down the output:
# - appId (this is your Client ID)
# - password (this is your Client Secret)
# - tenant (this is your Tenant ID)
Step 3: Grant Access to Key Vault
Your service principal needs permission to read secrets from the Key Vault.
Using Azure Portal:
-
Navigate to your Key Vault
-
Go to Access policies → Create
-
Under Secret permissions, select:
-
Get (required)
-
List (optional, but useful for debugging)
-
-
Click Next
-
Search for and select your service principal (e.g.,
hop-key-vault-app
) -
Click Next → Next → Create
Using Azure CLI:
# Get the object ID of your service principal
SP_OBJECT_ID=$(az ad sp list --display-name hop-key-vault-app --query [0].id -o tsv)
# Grant Get and List permissions
az keyvault set-policy \
--name my-company-hop-vault \
--object-id $SP_OBJECT_ID \
--secret-permissions get list
Step 4: Add Secrets to Key Vault
Using Azure Portal:
-
Navigate to your Key Vault
-
Go to Secrets → Generate/Import
-
Enter a Name (e.g.,
database-password
) -
Enter the Value (the actual secret)
-
Click Create
Using Azure CLI:
# Add a secret
az keyvault secret set \
--vault-name my-company-hop-vault \
--name database-password \
--value "MySecureP@ssw0rd!"
# Add multiple secrets
az keyvault secret set \
--vault-name my-company-hop-vault \
--name api-key \
--value "abc123xyz789"
Secret names in Azure Key Vault can only contain alphanumeric characters and hyphens. They must be between 1-127 characters long. |
Usage in Apache Hop
Creating the Variable Resolver
-
In Hop GUI, open the Metadata perspective (top-right icon)
-
Right-click in the metadata explorer → New → Variable Resolver
-
Select Azure Key Vault Variable Resolver
-
Enter a Name for your resolver (e.g.,
azure-kv
) -
Fill in the configuration:
-
Azure Key Vault URI:
https://my-company-hop-vault.vault.azure.net/
-
Azure Tenant ID: Your tenant GUID
-
Azure Client ID: Your application (client) ID
-
Azure Client Secret: Your client secret value
-
-
Click the Save icon
Variable Expression Format
To retrieve a secret from Azure Key Vault, use the following expression format:
#{resolver-name:secret-name}
Where:
-
resolver-name: The name you gave to your variable resolver metadata element (e.g.,
azure-kv
) -
secret-name: The name of the secret in Azure Key Vault
Examples
Assume you’ve created a variable resolver named azure-kv
and have the following secrets in your Key Vault:
Secret Name | Secret Value |
---|---|
database-password | MySecureP@ssw0rd! |
api-key | abc123xyz789 |
connection-string | Server=myserver;Database=mydb;User=admin;Password=secret; |
You can use these expressions in your pipelines and workflows:
-
#{azure-kv:database-password}
returnsMySecureP@ssw0rd!
-
#{azure-kv:api-key}
returnsabc123xyz789
-
#{azure-kv:connection-string}
returns the full connection string
Using in Database Connections
You can use the Azure Key Vault Variable Resolver in database connection configurations:
-
Create or edit a database connection
-
In the Password field, enter:
#{azure-kv:database-password}
-
When the connection is used, Hop will automatically resolve the password from Azure Key Vault
Best Practices
Security
-
Never hardcode credentials: Use the variable resolver instead of hardcoding secrets in your pipelines
-
Rotate secrets regularly: Update secrets in Azure Key Vault and restart Hop to pick up new values
-
Use different Key Vaults for different environments: Create separate Key Vaults for development, staging, and production
-
Limit permissions: Grant your service principal only the minimum required permissions (Get secrets)
-
Enable audit logging: Use Azure Monitor to track secret access
Performance
-
Caching: The resolver initializes once per Hop session and caches the connection
-
Avoid excessive calls: Secrets are fetched on-demand, so minimize resolver expressions in tight loops
-
Use environment-specific resolvers: Create separate variable resolver metadata for different environments
Multiple Resolvers
You can create multiple Azure Key Vault variable resolver metadata elements with different names:
-
azure-kv-abc
→ Points to Key Vault abc -
azure-kv-def
→ Points to Key Vault def
Then use them with different prefixes:
-
#{azure-kv-abc:database-password}
-
#{azure-kv-def:database-password}
Troubleshooting
Authentication Failures
If you see authentication errors in the Hop logs:
-
Verify credentials: Double-check that your Tenant ID, Client ID, and Client Secret are correct
-
Check secret expiration: Client secrets expire! Create a new one if yours has expired
-
Verify vault URI: Ensure the URI is correct and uses HTTPS
-
Check network connectivity: Ensure Hop can reach
vault.azure.net
Secret Not Found
If a secret cannot be found:
-
Check secret name: Secret names are case-sensitive
-
Verify permissions: Ensure your service principal has Get permission on secrets
-
Check secret exists: Verify the secret exists in the Key Vault using the Azure Portal
-
Check deleted secrets: Azure Key Vault has soft-delete; the secret might be in a deleted state
Enable Debug Logging
To see detailed logging from the variable resolver, increase the logging level in your pipeline run configuration or workflow run configuration.
Limitations
-
Secret names: Azure Key Vault secret names can only contain alphanumeric characters and hyphens
-
Secret versions: This resolver always retrieves the latest version of a secret
-
Complex secret formats: Azure Key Vault stores secrets as plain strings, unlike HashiCorp Vault which supports structured JSON natively
-
Initialization: The resolver initializes on first use; the first resolution may take slightly longer