hi i've set-up credentials hooks (kedro 0.19) and want to access the azure_creds values from inside the pipelines file to pass them to the node function, but OmegaConfigLoader is returning an empty value, is there a solution to this ?
#hooks.py from kedro.framework.hooks import hook_impl from azure.keyvault.secrets import SecretClient from azure.identity import DefaultAzureCredential class AzureSecretsHook: @hook_impl def after_context_created(self, context) -> None: keyVaultName = "keyvault-0542abb" # or os.environ["KEY_VAULT_NAME"] if you would like to provide it through environment variables KVUri = f"https://{keyVaultName}.vault.azure.net" my_credential = DefaultAzureCredential() client = SecretClient(vault_url=KVUri, credential=my_credential) secrets = { "abs_creds": "azure-blob-store", "s3_creds": "s3-bucket-creds", } azure_creds = { cred_name: client.get_secret(secret_name).value for cred_name, secret_name in secrets.items() } context.config_loader["credentials"] = { **context.config_loader["credentials"], **azure_creds, }
Hi i've setup my azure credentials as suggested but when i run the node I get "dict() got multiple values for keyword argument 'abs_creds'" does anyone know a potential reason with this ?
# hooks.py from kedro.framework.hooks import hook_impl from azure.keyvault.secrets import SecretClient from azure.identity import DefaultAzureCredential class AzureSecretsHook: @hook_impl def after_context_created(self, context) -> None: keyVaultName = "keyvault-0542abb" # or os.environ["KEY_VAULT_NAME"] if you would like to provide it through environment variables KVUri = f"https://{keyVaultName}.vault.azure.net" my_credential = DefaultAzureCredential() client = SecretClient(vault_url=KVUri, credential=my_credential) secrets = { "abs_creds": "azure-blob-store", "s3_creds": "s3-bucket-creds", } azure_creds = { cred_name: client.get_secret(secret_name).value for cred_name, secret_name in secrets.items() } context.config_loader["credentials"] = { **context.config_loader["credentials"], **azure_creds, }