Open
Description
- Environment Details:
- Python SDK version: 1.42.0
- Authentication: Using DefaultAzureCredential (falling back to Azure CLI)
- Token acquisition is successful (token starts with "eyJ0eXAiOi...")
- Identical configuration works successfully in C# but fails in Python
- Tested Approaches:
- Using the raw token directly: speech_config.authorization_token = token
- Using a formatted token like C#: aad#{resourceId}#{token}
- Setting token via property ID: set_property(SpeechServiceAuthorization_Token, token)
- Setting auth type explicitly: set_property(SpeechServiceAuthorization_Type, "Bearer")
- Using a single synthesizer for all segments (like C# does)
- Using standard voices instead of HD voices
- Using simplified SSML without custom parameters - Error Details:
- Synthesis appears to start (synthesizer is created successfully)
- Service times out after ~80 seconds
- Error is always: "USP error: timeout waiting for the first audio chunk"
- No audio data is received despite successful token acquisition - Working C# Implementation:
` private static async Task GetAiServicesAuthorizationTokenAsync(CancellationToken cancellationToken)
{
const string scope = "https://cognitiveservices.azure.com/.default";
var tokenCredential = new DefaultAzureCredential();
var token = await tokenCredential.GetTokenAsync(new Azure.Core.TokenRequestContext([scope]), cancellationToken);
return token.Token;
}
// Later used with:
var authorizationToken = await GetAiServicesAuthorizationTokenAsync(cancellationToken);
var speechConfig = SpeechConfig.FromAuthorizationToken($"aad#{speechResourceId}#{authorizationToken}", speechRegion);`
We've ruled out most common issues (token formatting, SSML structure, voice selection), this appears to be either:
- A limitation in the Python SDK's implementation for managed identity
- A possible network/connectivity issue specific to the Python SDK
- An undocumented requirement for additional configuration when using managed identity with Python
Here is a repro script.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Untriaged