|
7 | 7 | import asyncio |
8 | 8 | from azure.appconfiguration.provider.aio import load |
9 | 9 | from azure.appconfiguration.provider import SettingSelector, AzureAppConfigurationKeyVaultOptions |
10 | | -from azure.keyvault.secrets.aio import SecretClient |
11 | 10 | import os |
12 | | -from sample_utilities import get_authority, get_audience, get_credential |
| 11 | +from sample_utilities import get_authority, get_credential |
13 | 12 |
|
14 | 13 | async def main(): |
15 | 14 | endpoint = os.environ.get("AZURE_APPCONFIG_ENDPOINT") |
16 | 15 | key_vault_uri = os.environ.get("AZURE_KEYVAULT_URI") |
17 | 16 | authority = get_authority(endpoint) |
18 | | - audience = get_audience(authority) |
19 | 17 | credential = get_credential(authority, is_async=True) |
20 | 18 |
|
| 19 | + breakpoint() |
| 20 | + |
21 | 21 | # Connection to Azure App Configuration using AAD with Provided Client |
22 | | - secret_client = SecretClient(vault_url=key_vault_uri, credential=credential) |
| 22 | + client_configs = {key_vault_uri: {'credential': credential}} |
23 | 23 | selects = {SettingSelector(key_filter="*", label_filter="prod")} |
24 | | - key_vault_options = AzureAppConfigurationKeyVaultOptions(secret_clients=[secret_client]) |
| 24 | + key_vault_options = AzureAppConfigurationKeyVaultOptions(client_configs=client_configs) |
25 | 25 | config = await load(endpoint=endpoint, credential=credential, key_vault_options=key_vault_options, selects=selects) |
26 | 26 |
|
27 | 27 | print(config["secret"]) |
28 | 28 |
|
29 | 29 | await credential.close() |
30 | | - await secret_client.close() |
31 | 30 | await config.close() |
32 | 31 |
|
33 | 32 | if __name__ == "__main__": |
34 | | - asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) |
| 33 | + asyncio.set_event_loop_policy(asyncio.DefaultEventLoopPolicy()) |
35 | 34 | asyncio.run(main()) |
0 commit comments