Azure Key Vault Integration
GGScout supports integration with Azure Key Vault to collect and monitor your secrets. This guide will help you set up and configure the integration.
Supported Features
- Multiple secret versions collection
- DefaultAzureCredential authentication
- Managed Identity authentication
- Service Principal authentication
- Cross-tenant access
Configuration
To configure GGScout to work with Azure Key Vault, add the following configuration to your ggscout.toml
file:
[sources.azure-source-playground]
type = "azurekeyvault"
fetch_all_versions = true
subscription_id = "${AZURE_SUBSCRIPTION_ID}"
Configuration Parameters
Parameter | Description | Required |
---|---|---|
type | Must be set to "azurekeyvault" | Yes |
fetch_all_versions | Whether to collect all versions of secrets | No |
subscription_id | Your Azure subscription ID | Yes |
Authentication
GGScout uses the DefaultAzureCredential for authentication, which attempts to authenticate using the following methods in order:
- Environment variables
- Workload Identity
- Managed Identity
- Shared Token Cache
- Visual Studio
- Azure CLI
- Azure PowerShell
- Azure Developer CLI
- Interactive Browser
Authentication methods cannot be directly configured in the TOML file. Instead, you must provide the necessary environment variables for your chosen authentication method.
Environment Variables
For Service Principal authentication, you must set the following environment variables:
AZURE_SUBSCRIPTION_ID
: Your Azure subscription IDAZURE_TENANT_ID
: Your Azure tenant IDAZURE_CLIENT_ID
: Your service principal client IDAZURE_CLIENT_SECRET
: Your service principal client secret
For other authentication methods, refer to the Azure Identity documentation for the required environment variables.
Required Azure Permissions
To fetch secrets from Azure Key Vault, the identity used by GGScout (whether it's a Managed Identity, Service Principal, or user account) must have the appropriate permissions assigned.
RBAC Permissions
The identity must have at least one of the following built-in roles assigned to the Key Vault:
- Key Vault Secrets User (
Key Vault Secrets User
): Allows reading secret values - Key Vault Secrets Officer (
Key Vault Secrets Officer
): Allows reading and managing secrets - Key Vault Administrator (
Key Vault Administrator
): Full access to Key Vault
For more granular control, you can create a custom role with the following permissions:
{
"Name": "GGScout Key Vault Reader",
"Description": "Allows GGScout to read secrets from Key Vault",
"Actions": [
"Microsoft.KeyVault/vaults/secrets/read",
"Microsoft.KeyVault/vaults/secrets/versions/read",
"Microsoft.KeyVault/vaults/secrets/list"
],
"NotActions": [],
"DataActions": [],
"NotDataActions": [],
"AssignableScopes": [
"/subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/Microsoft.KeyVault/vaults/{vault-name}"
]
}
Access Policy (Legacy)
If your Key Vault is using the older Access Policy model instead of RBAC, the identity must have the following permissions:
- Get and List permissions for secrets
For production environments, it's recommended to use RBAC for Key Vault access management as it provides more granular control and better integration with Azure's identity management.
Best Practices
- Use Managed Identity when running on Azure infrastructure
- Follow the principle of least privilege for role assignments
- Enable
fetch_all_versions
to track changes in your secrets over time - Regularly rotate service principal credentials
- Use separate Key Vaults for different environments