Skip to content

Commit e25274d

Browse files
niuzheng168Zheng Niuxitzhang
authored
foundry agent cannot use key auth (#45056)
* foundry agent cannot use key auth * chat supervisor agent cannot use key auth --------- Co-authored-by: Zheng Niu <zhn@microsoft.com> Co-authored-by: xitzhang <zhangxiting.zxt@gmail.com>
1 parent 7337d70 commit e25274d

1 file changed

Lines changed: 5 additions & 14 deletions

File tree

sdk/ai/azure-ai-voicelive/samples/supervisor_agent_sample.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
from typing import Union, Optional, cast
2727
from concurrent.futures import ThreadPoolExecutor
2828

29+
from azure.identity.aio import AzureCliCredential
30+
2931
# Audio processing imports
3032
try:
3133
import pyaudio
@@ -355,7 +357,7 @@ class AsyncSupervisorAgentClient:
355357
def __init__(
356358
self,
357359
endpoint: str,
358-
credential: Union[AzureKeyCredential, AsyncTokenCredential],
360+
credential: AsyncTokenCredential,
359361
model: str,
360362
voice: str,
361363
instructions: str,
@@ -541,21 +543,10 @@ async def _handle_event(self, event, connection) -> None:
541543
async def main() -> None:
542544
"""Main entry point for the supervisor agent sample."""
543545
# Get credentials from environment variables
544-
api_key = os.environ.get("AZURE_VOICELIVE_API_KEY")
545546
endpoint = os.environ.get("AZURE_VOICELIVE_ENDPOINT", "wss://api.voicelive.com/v1")
546547

547-
if not api_key:
548-
print("❌ Error: No AZURE_VOICELIVE_API_KEY provided")
549-
print("Please set the AZURE_VOICELIVE_API_KEY environment variable.")
550-
sys.exit(1)
551-
552-
# Option 1: API key authentication (simple, recommended for quick start)
553-
credential: Union[AzureKeyCredential, AsyncTokenCredential] = AzureKeyCredential(api_key)
554-
555-
# Option 2: Async AAD authentication (requires azure-identity)
556-
# Uncomment the lines below to use AAD authentication instead:
557-
# from azure.identity.aio import AzureCliCredential, DefaultAzureCredential
558-
# credential = AzureCliCredential()
548+
549+
credential = AzureCliCredential()
559550

560551
# Create and run the supervisor agent client
561552
client = AsyncSupervisorAgentClient(

0 commit comments

Comments
 (0)