Monday, May 8, 2023

How to Access Cognitive Service Translator API With Virtual Network Endpoint

Microsoft Cognitive Service translator accessible with Web API, Virtual Network and container endpoints. This blog explains how to access cognitive service with virtual network endpoint.

Pre-requisites: cognitive service translator

Go to translator app Networking under Resource Management. Select Firewalls and virtual networks tab.


Select Network and Private Endpoints radio button mark with number 1

You can add existing virtual network from the link mark with number 2 or add new virtual network from the link mark with number 3. Choose suitable option for your case and add a virtual network.

Once virtual network has been added, you can find list of virtual networks as shown with number 4. Finally click on save button to save your changes.

Go to Keys and Endpoint section of translator to find keys and endpoints. 

We are going to use Postman to test the translator. To do that, configure postman as explained in this blog.

Send postman POST request from your working machine which is not inside virtual network.

It will give 403AccessDenied status.


Let's access translator from the allowed subnet and VNet. (You can use a virtual machine, containerized app inside the subnet of the VNet). Here we are using postman in a virtual machine deployed in the translator service allowed subnet, of the virtual network.

Use the URL format as below.

https://my-demo-translator.cognitiveservices.azure.com/translator/text/v3.0/translate?from=en&to=fr

You will get 200 OK status similar to the following image.









No comments:

Post a Comment