Azure Language in Microsoft Foundry Tools
Unit 2 of 7 · Module 16: Analyze text with Azure Language in Foundry Tools
Go deeper
Unlocks when you've watched the lesson.
Read this lesson
What's in the building
Think of Azure Language as a building full of text services. Three of them are the main ones you'll use in this module. Language detection tells you which language a piece of text is written in. Named entity recognition finds the people, places, dates, organizations and other things it mentions. And PII detection finds personal details, like names and phone numbers, and can hide them. The service also has older features, such as sentiment analysis, summaries and key phrases. The docs call these legacy capabilities: they're still supported for apps that already use them, but new projects should start with the core features.
One resource, one address
To use it, you create a Microsoft Foundry resource in your Azure subscription. That resource gets an endpoint, which is its web address, and keys. Your code sends each request to that endpoint. There are two ways to do that. You can send REST requests yourself, with a JSON body that holds your text. Or you can use an SDK, a client library that builds those requests for you. This module's examples use the Python SDK, and the libraries for C sharp, JavaScript and other languages follow the same pattern.
The flat and the building
Here's the part that trips people up. In the Foundry portal, your project's Home page shows a key and the project endpoint. But a project lives inside a resource, like a flat inside an apartment building. The project endpoint is the building's address with slash api slash projects slash your project's name added on the end. Azure Language wants the building's address, so you trim that last part off. The key is the same for both. To see the resource itself, open Operate, then Admin, and look at the parent resource of your project.
Showing who you are
Every request has to prove it's allowed in. The simplest way is the key. It works like a door key: whoever holds it gets in, so keep it secret. The safer way, and the one Microsoft recommends for production, is a Microsoft Entra ID identity, more like a resident's badge with a name on it. Your identity needs a role on the resource, such as Cognitive Services User. In Python, you install azure dash ai dash textanalytics. For a key, you wrap it in an AzureKeyCredential. For Entra ID, you install azure dash identity and use DefaultAzureCredential, which picks up whoever your code is running as, like your az login. Either way, you pass the endpoint and the credential to a TextAnalyticsClient, and that client makes every call from then on.
Facts from Microsoft's documentation: What is Azure Language in Foundry Tools?; Authentication in Foundry Tools; Role-based access control for Azure Language; Azure Text Analytics client library for Python (CC BY 4.0), rewritten in Loop's own words and examples. Narration, animation, and quiz by Loop. Microsoft, Azure, and Microsoft Foundry are trademarks of Microsoft. Loop is independent and not affiliated with or endorsed by Microsoft.