Skip to content

AzureKeyVaultSettingsSource tries to load disabled secrets #572

@CisterMoke

Description

@CisterMoke

The AzureKeyVaultSettingsSource throws an error when the keyvault contains disabled secrets.

KeyVault disabled setting:
Image

Error raised by AzureKeyVaultSettingsSource:

Traceback (most recent call last):
  File "c:\<project_dir>\.venv\lib\site-packages\pydantic_settings\sources.py", line 2214, in __getitem__
    self._loaded_secrets[key] = self._secret_client.get_secret(key).value
  (...)
azure.core.exceptions.HttpResponseError: (Forbidden) Operation get is not allowed on a disabled secret.
Code: Forbidden
Message: Operation get is not allowed on a disabled secret.
Inner error: {
    "code": "SecretDisabled"
}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\<project_dir>\main.py", line 95, in <module>
    settings = Settings()
  (...)
  File "c:\<project_dir>\.venv\lib\site-packages\pydantic_settings\sources.py", line 2216, in __getitem__
    raise KeyError(key)
KeyError: 'disabled-setting'

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions