Blog Post

Microsoft Developer Community Blog
2 MIN READ

Use Cases for Testing Restrictoutboundnetworkaccess for Speech Service

Shikhaghildiyal's avatar
Aug 12, 2024

Transcribing an Audio File from a Storage Account Using the Speech Service

Testing the RestrictOutboundNetworkAccess feature in Azure Speech Service is essential for scenarios like securely transcribing audio files from your storage account. When outbound access is unrestricted, the Speech Service easily fetches and transcribes audio. But with restrictions, only allowed domains are accessible, ensuring data privacy and compliance with organizational policies. This is crucial for protecting sensitive data and meeting strict security standards. By testing these settings, you validate both the functionality and security of the Speech Service in different network setups.
 

Use Case 1 – Azure Speech Service Outbound access not restricted

 

 

  1. Prepare the Audio File: Upload the audio file to your storage account and note its URL. We can take sample file from here: cognitive-services-speech-sdk/sampledata/audiofiles at master · Azure-Samples/cognitive-services-speech-sdk · GitHub
  2. Set Up the Speech Service: Obtain the API key and endpoint URL from your speech service in Azure as below reference
     

     
  3. Make the GET Request: Follow below steps in Postman to make a POST request to Speech Service: 
     
    1. Open Postman and create a new POST request.
    2. Set the URL to https://<SpeechServiceLocation>.api.cognitive.microsoft.com/speechtotext/v3.2/transcriptions.
    3. Add Headers:
      Ocp-Apim-Subscription-Key:    <keyOfSpeechService>
      Content-Type: application/json
       
    4. Set the Body to raw and select JSON format.
    5. Then, paste the following JSON:
       
      {
        "contentUrls": [
          "SASLinkToAudioFileOnStorage"
        ],
        "locale": "en-US",
        "displayName": "My Transcription",
        "model": null,
        "properties": {
          "wordLevelTimestampsEnabled": true,
          "languageIdentification": {
            "candidateLocales": [
              "en-US", "de-DE", "es-ES"
            ]
          }
        }
      }​

 

The Post Request will return a status code of 201 as shown – it indicates that the request was successfully processed, and a new transcription job has been created. This status code confirms that the transcription process has been initiated

 

 

In the response body of the POST request, find the URL provided under the ‘Links’ section and make a GET request to that URL.

 


The response from this GET request will contain a contentUrl, which you need to use to make another request to fetch the transcribed data

 

Since the outbound access was not disabled, we were able to fetch the Transcribed data from speech service.

 

 

UseCase 2 – Azure Speech Service Outbound access is restricted

 

 

Repeat the steps as mentioned in UseCase1 to send POST request to Speech Service.
The request will return a status code of 403.This means that we are not allowed to access Audio File from Storage account because here we have mentioned -  restrictOutboundNetworkAccess": true, and "allowedFqdnList": "microsoft.com" which means we have restricted outbound access and speech service can only access “microsoft.com” only.

 

 

 

Updated Aug 12, 2024
Version 5.0
No CommentsBe the first to comment