Error 401 with Text to Speech, even though i have the correct key.

Legate Lanius 0 Reputation points
2024-09-16T03:33:31.59+00:00

please someone give me a hand. i have an application that uses azure text to speech, out of the blue it stopped working and is giving me this error:

Speech synthesis canceled: CancellationReason.Error

Error details: WebSocket upgrade failed: Authentication error (401). Please check subscription information and region name. USP state: Sending. Received audio size: 0 bytes.

ive double and triple checked subscription information and its all matching i ran the curl

curl -v -X POST "https://eastus.api.cognitive.microsoft.com/sts/v1.0/issueToken" -H "Ocp-Apim-Subscription-Key: MY-KEY" -H "Content-type: application/x-www-form-urlencoded" -H "Content-Length: 0"

and it gave me this in return:

* Host eastus.api.cognitive.microsoft.com:443 was resolved.
* IPv6: (none)
* IPv4: 20.232.91.180
*   Trying 20.232.91.180:443...
* Connected to eastus.api.cognitive.microsoft.com (20.232.91.180) port 443
* schannel: disabled automatic use of client certificate
* ALPN: curl offers http/1.1
* ALPN: server accepted http/1.1
* using HTTP/1.x
> POST /sts/v1.0/issueToken HTTP/1.1
> Host: eastus.api.cognitive.microsoft.com
> User-Agent: curl/8.7.1
> Accept: */*
> Ocp-Apim-Subscription-Key: MY KEY
> Content-type: application/x-www-form-urlencoded
> Content-Length: 0
>
* Request completely sent off
< HTTP/1.1 403 Forbidden
< Content-Length: 90
< Content-Type: application/json
< apim-request-id: 56ede141-c0ba-45fc-9bb3-425e3a0be1ad
< Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
< x-content-type-options: nosniff
< policy-id: ThrowExceptionDueToTrafficDenied
< Date: Mon, 16 Sep 2024 03:10:33 GMT
<
{"error":{"code":"403","message": "Access denied due to Virtual Network/Firewall rules."}}* Connection #0 to host eastus.api.cognitive.microsoft.com left intact

please help i have such a head ache over all of this

Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
1,737 questions
{count} votes

1 answer

Sort by: Most helpful
  1. navba-MSFT 24,625 Reputation points Microsoft Employee
    2024-09-16T06:48:36.62+00:00

    @Legate Lanius The error message says Access denied due to Virtual Network/Firewall rules . So Could you please try to add your new public (updated) IP address under the firewall section and check if that works fine. Awaiting your reply.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.