Hello,
I am experiencing an authentication issue when attempting to use Azure Cognitive Services Speech-to-Text with a Private Endpoint from an Azure App Service. Below are the details of my configuration and the error message I am receiving.
Issue Description:
My Azure App Service connects to Azure Cognitive Services Speech-to-Text.
❌ Current Behavior (With "Selected Networks and Private Endpoints" Enabled)
- When I restrict access to "Selected Networks and Private Endpoints", the application fails with a 401 error:
CANCELED: ErrorDetails=WebSocket upgrade failed: Authentication error (401). Please check subscription information and region name.
- The application uses Managed Identity for authentication. The configuration code is:
var config = SpeechConfig.FromAuthorizationToken(authorizationToken, region);
- This issue only occurs when the Private Endpoint is enabled.
Current Network Configuration
- Virtual Network and Subnets
- VNet Name:
my-vnet
- Subnet for Private Endpoint:
cognitive-private-endpoint-subnet
- Outbound Subnet for App Service:
appservice-outbound (10.0.1.240/29)
- Private Endpoint Configuration
- Custom Route Table for App Service Outbound Traffic
- Route Name:
private-speech-route
- Address Prefix:
10.0.0.4/32
- Next Hop Type:
Virtual Network
- IAM Role Assignments (For Managed Identity Authentication)
The App Service has the following IAM role assignments:
- Cognitive Services Speech Contributor
- Cognitive Services Speech User
- Assigned at the resource level for
my-speech-service
.
Troubleshooting Steps Taken
✅ Verified Private Endpoint DNS Resolution:✅ Successful (nslookup
returns private IP)
✅ Checked IAM Role Assignments: ✅ Proper roles assigned
✅ Checked Route Table Configuration: ✅ Custom route configured for private IP
✅ Tested Authentication via Managed Identity: ✅ Works when access is unrestricted
❌ Fails when network access is set to "Selected Networks and Private Endpoints"
Questions to community:
- Why does authentication fail with a 401 error when using a Private Endpoint, despite the correct IAM roles being assigned?
- Are there any additional permissions required for Managed Identity authentication over a Private Endpoint?
- Is there an additional step required for WebSocket-based connections through Private Endpoints?
- Are there known limitations for Private Endpoint usage with Speech-to-Text services?
Thank you for your assistance.