Azure VM times out when making post request to speech services

Gianluca Perrone 20 Reputation points
2023-10-18T19:14:20.95+00:00

Hello everyone!

I have a speech service that I use to create audio files from text. ( Text to Speech ).
This service needs a post request with a ssml to generate it's audio. This post request works fine in a development environment, but times out when I try to do it through a VM in azure.

The VM in question is a Standard B2ms (2 vcpus, 8 GiB memory).

Below is the request, with my speech key omitted:

curl --location --request POST "https://eastus.tts.speech.microsoft.com/cognitiveservices/v1" \
--header "Ocp-Apim-Subscription-Key: ${SPEECH_KEY}" \
--header 'Content-Type: application/ssml+xml' \
--header 'X-Microsoft-OutputFormat: audio-16khz-128kbitrate-mono-mp3' \
--header 'User-Agent: curl' \
--data-raw '<speak version='\''1.0'\'' xml:lang='\''en-US'\''>
    <voice xml:lang='\''en-US'\'' xml:gender='\''Female'\'' name='\''en-US-JennyNeural'\''>
        my voice is my passport verify me
    </voice>
</speak>' > output.mp3

Below is the timeout error:Screenshot 2023-10-18 at 19.53.35

I assumed this was a NSG issue, and tried to open every possible port and connection to the machine:

Screenshot 2023-10-18 at 19.55.26

This lead to the same results.

The virtual network attached to the machine also has no configured Firewall, and the DNS server is now marked as Default (Azure-provided), but I did try using Google's instead with no success.

This the result of pinging this domain:

Screenshot 2023-10-18 at 20.01.56

Below are prints from commands that might be informative for this question:

Screenshot 2023-10-18 at 20.03.43

-------------------------------------------------------------------------------------------Screenshot 2023-10-18 at 20.04.57

-------------------------------------------------------------------------------------------Screenshot 2023-10-18 at 20.06.37

-------------------------------------------------------------------------------------------Screenshot 2023-10-18 at 20.10.08

-------------------------------------------------------------------------------------------Screenshot 2023-10-18 at 20.11.41

I'd really appreciate any ideas for this situation. I have already contacted microsoft's support team, but so far they've only told me that the nsg must be configured incorrectly, specifically when it comes to the traffic on port 443.

Thank you very much!

Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
1,435 questions
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,247 questions
Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,195 questions
{count} votes

Accepted answer
  1. navba-MSFT 17,395 Reputation points Microsoft Employee
    2023-10-19T06:11:27.31+00:00

    @Gianluca Perrone Welcome to Microsoft Q&A Forum, Thank you for posting your query here!

    I see that you are experiencing a timeout issue when making a post request to the Azure Speech Services from a VM in Azure. The customer has already tried to open every possible port and connection to the machine, but the issue persists

    Looking at the error message its pretty clear that this is related to the network connectivity. Please follow the below action plan to isolate this issue.

    Plan 1:
    Please run the below telnet command from the Azure VM.

    telnet eastus.tts.speech.microsoft.com 443

    If the ports are open and connectivity is fine, you should see a blank window like below:
    User's image

    Plan 2:

    You can download the port query UI tool and extract its contents. Then launch the portqueryui.exe fill the required details as shown below and click on Query button. You should see an output saying Listening if ports are open.
    User's image

    Plan 3:

    Please check if you get http status code 200 from the postman.
    User's image


    Plan 4:***

    RDP to your Azure VM and open the Azure Speech Studio and then click on Audio Content Creation to leverage the text to speech feature and see if that works fine.

    User's image

    Select Text File:
    User's image

    Then select the voice, quality and click on play button and then you can export you audio as shown below:
    User's image

    Plan 5:

    Please open the Networking blade of your Speech service: User's image **

    **
    You can try adding your existing Vnet and check if that helps:
    User's image

    You can also try to Enable a service endpoint for Azure AI services within the virtual network. The service endpoint routes traffic from the virtual network through an optimal path to the Azure AI services service. For more information, see Virtual Network service endpoints.
    User's image

    More Info about Azure AI Service Networking option is explained here.

    If none of the above action plan helps. Please let me know. I would be happy to assist you further.

    Awaiting your reply.

    **

    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Gianluca Perrone 20 Reputation points
    2023-10-23T09:07:55.61+00:00

    The support teams answer was good, but what ended up fixing the issue was disabling the service endpoints I already had in my Virtual network. Hope that helps anyone.

    0 comments No comments