An Azure service that integrates speech processing into apps and services.
The most secure browser pattern is to avoid exposing an API key and avoid giving the browser a long-lived Microsoft Entra access token.
For Voice Live from Microsoft Foundry:
- Use Microsoft Entra ID authentication rather than an API key when possible. Voice Live supports Entra ID and API key authentication, and Entra ID is the recommended method.
- If the client is a browser, do not rely on connection headers for auth. For browser scenarios, Voice Live supports passing auth on the WebSocket request URI because prehandshake headers are not available in browsers.
- Use a backend token broker/service:
- The backend acquires the Entra token with scope
https://ai.azure.com/.defaultor legacyhttps://cognitiveservices.azure.com/.default. - The backend returns only a short-lived token or otherwise brokers session setup.
- The browser uses that token on the Voice Live WebSocket request.
- The backend acquires the Entra token with scope
- Keep tokens in memory only in the browser. Do not store them in persistent browser storage.
- If stronger isolation is needed, use a backend to proxy session negotiation so the browser does not directly hold the token. A related real-time audio pattern explicitly calls out proxying browser session negotiation through a service as more secure because the browser does not have access to the ephemeral token.
For the WebSocket connection itself:
- Use the Voice Live endpoint:
-
wss://<your-ai-foundry-resource-name>.services.ai.azure.com/voice-live/realtime?api-version=2026-04-10
-
- In browser scenarios, auth can be passed as a query parameter:
-
Authorization=Bearer <token>for Entra ID, URL-encoded as needed - or
api-key=<key>
-
- Query string parameters are encrypted by the
wss://transport, but that does not remove the browser exposure concern if the token is present in client code or browser tooling.
Given the concern that the token is visible in the browser, the recommended practical approach is:
- Best security: backend-brokered flow so the browser does not directly hold a reusable credential.
- Acceptable direct browser approach: Entra token instead of API key, short-lived, scoped correctly, and kept only in memory.
- Least preferred: putting an API key in the browser.
Also note:
- Voice Live is optimized for Microsoft Foundry resources.
- Azure AI Speech resources do not support Microsoft Foundry Agent Service integration or bring-your-own-model for Voice Live.
- How to use the Voice Live API
- Voice Live
2026-04-10API Reference - Use the GPT Realtime API via WebRTC
- Is it considered acceptable/safe to use an Azure AD access token in the browser for Cognitive Services when /issueToken is unavailable? - Microsoft Q&A
- How to securely use Azure Speech services in SPA app - Microsoft Q&A