Skip to content

Commit

Permalink
add environment variables to keyvault lookup plugin (#978)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fred-sun authored Sep 22, 2022
1 parent f983471 commit 444c191
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions plugins/lookup/azure_keyvault_secret.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
try:
import requests
import logging
import os
from azure.common.credentials import ServicePrincipalCredentials
from azure.keyvault import KeyVaultClient
from msrest.exceptions import AuthenticationError, ClientRequestError
Expand Down Expand Up @@ -150,9 +151,9 @@ def lookup_secret_non_msi(terms, vault_url, kwargs):
logging.getLogger('msrestazure.azure_active_directory').addHandler(logging.NullHandler())
logging.getLogger('msrest.service_client').addHandler(logging.NullHandler())

client_id = kwargs.pop('client_id', None)
secret = kwargs.pop('secret', None)
tenant_id = kwargs.pop('tenant_id', None)
client_id = kwargs['client_id'] if kwargs.get('client_id') else os.environ.get('AZURE_CLIENT_ID')
secret = kwargs['secret'] if kwargs.get('secret') else os.environ.get('AZURE_SECRET')
tenant_id = kwargs['tenant_id'] if kwargs.get('tenant_id') else os.environ.get('AZURE_TENANT')

try:
credentials = ServicePrincipalCredentials(
Expand Down

0 comments on commit 444c191

Please sign in to comment.