Detect Language Using Azure AI Services

This Microsoft Azure AI Services and .NET blog post will show how to detect a language using the Azure AI Services SDK for .NET.

Azure AI Services offers a wide range of AI services, including the AI-Language Detection API, which can identify text input. The API can detect a language from a submitted text or a document with up to 5,120 characters.

This post will use the Azure AI Services SDK for .NET, making the API’s interaction smooth.

Console App

In the following console app, we are using the following components,

To get started, we need to create an Azure AI Multi Service resource to copy the endpoint and access key details.


Using the endpoint and access key details, create an appsettings.json file with the following configuration (replace with your endpoint and access key details).

"AIServicesEndpoint": "ENDPOINT URL",
    "AIServicesKey":  "ACCESS KEY"


Save the file, and copy the following code into yours .CSPROJ file.


Finally, use the following code in your program.cs file.

Note: The variable var text = “something” is the input we pass to the API to detect.


Save the files and run them with dotnet run

The output is shown below.

 Detected Language: English






Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.