-
Notifications
You must be signed in to change notification settings - Fork 3.2k
foundry agent cannot use key auth #45056
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -26,6 +26,8 @@ | |||||||||||||||||||||||||||||||||
| from typing import Union, Optional, cast | ||||||||||||||||||||||||||||||||||
| from concurrent.futures import ThreadPoolExecutor | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| from azure.identity.aio import AzureCliCredential, DefaultAzureCredential | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| # Audio processing imports | ||||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||||
| import pyaudio | ||||||||||||||||||||||||||||||||||
|
|
@@ -355,7 +357,7 @@ class AsyncSupervisorAgentClient: | |||||||||||||||||||||||||||||||||
| def __init__( | ||||||||||||||||||||||||||||||||||
| self, | ||||||||||||||||||||||||||||||||||
| endpoint: str, | ||||||||||||||||||||||||||||||||||
| credential: Union[AzureKeyCredential, AsyncTokenCredential], | ||||||||||||||||||||||||||||||||||
| credential: Union[AzureCliCredential, DefaultAzureCredential], | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
| model: str, | ||||||||||||||||||||||||||||||||||
| voice: str, | ||||||||||||||||||||||||||||||||||
| instructions: str, | ||||||||||||||||||||||||||||||||||
|
|
@@ -541,21 +543,10 @@ async def _handle_event(self, event, connection) -> None: | |||||||||||||||||||||||||||||||||
| async def main() -> None: | ||||||||||||||||||||||||||||||||||
| """Main entry point for the supervisor agent sample.""" | ||||||||||||||||||||||||||||||||||
| # Get credentials from environment variables | ||||||||||||||||||||||||||||||||||
| api_key = os.environ.get("AZURE_VOICELIVE_API_KEY") | ||||||||||||||||||||||||||||||||||
| endpoint = os.environ.get("AZURE_VOICELIVE_ENDPOINT", "wss://api.voicelive.com/v1") | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if not api_key: | ||||||||||||||||||||||||||||||||||
| print("❌ Error: No AZURE_VOICELIVE_API_KEY provided") | ||||||||||||||||||||||||||||||||||
| print("Please set the AZURE_VOICELIVE_API_KEY environment variable.") | ||||||||||||||||||||||||||||||||||
| sys.exit(1) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| # Option 1: API key authentication (simple, recommended for quick start) | ||||||||||||||||||||||||||||||||||
| credential: Union[AzureKeyCredential, AsyncTokenCredential] = AzureKeyCredential(api_key) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| # Option 2: Async AAD authentication (requires azure-identity) | ||||||||||||||||||||||||||||||||||
| # Uncomment the lines below to use AAD authentication instead: | ||||||||||||||||||||||||||||||||||
| # from azure.identity.aio import AzureCliCredential, DefaultAzureCredential | ||||||||||||||||||||||||||||||||||
| # credential = AzureCliCredential() | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| credential = AzureCliCredential() | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+548
to
+549
|
||||||||||||||||||||||||||||||||||
| credential = AzureCliCredential() | |
| # Choose the authentication method you want to use: | |
| # | |
| # Option 1: Use DefaultAzureCredential (recommended for most applications) | |
| # This will use environment variables, managed identity, Visual Studio Code, Azure CLI, etc. | |
| # from azure.identity.aio import DefaultAzureCredential | |
| # credential = DefaultAzureCredential() | |
| # | |
| # Option 2: Use AzureCliCredential (for local development with an authenticated Azure CLI session) | |
| credential = AzureCliCredential() | |
| # | |
| # Option 3: Use API key authentication | |
| # Set the AZURE_VOICELIVE_API_KEY environment variable with your key. | |
| # from azure.core.credentials import AzureKeyCredential | |
| # credential = AzureKeyCredential(os.environ["AZURE_VOICELIVE_API_KEY"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The imports AzureKeyCredential and AsyncTokenCredential (lines 50-51) are no longer used after removing API key authentication support. These unused imports should be removed to keep the code clean. However, if API key support is restored (as recommended), these imports should remain.