Hello Narayanasetti, Vinodh Kumar,
Welcome to the Microsoft Q&A and thank you for posting your questions here.
I understand that your CognitiveServices Language TextAnalytics API is not working.
This is not simply an intermittent service fault; it is a direct result of Microsoft officially retiring the Text Analytics v2.x API on February 29, 2024, which your existing SDK still uses. The recent “Operation returned an invalid status code 'Gone'” message indicates that the v2.1 endpoint (https://{region}.api.cognitive.microsoft.com/text/analytics/v2.1/keyPhrases) has now been permanently disabled for your Azure region, causing all requests routed through this legacy path to fail. You can confirm this by running a simple curl test that returns an HTTP 410 (Gone) status. Azure Cognitive Services Text Analytics v2.x Retirement Notice
Therefore, to restore functionality, you must migrate to the current Azure AI Language or Azure.AI.TextAnalytics SDK that uses the unified API endpoint format — https://<your-language-resource-endpoint>/language/:analyze-text?api-version=2024-11-01. This endpoint uses a new request structure with "kind": "KeyPhraseExtraction" and an analysisInput payload instead of the older MultiLanguageBatchInput. The updated SDKs also use modern authentication mechanisms such as AzureKeyCredential or DefaultAzureCredential, replacing the deprecated ApiKeyServiceClientCredentials. Migrate to the Latest Azure AI Language Service
To implement the fix, first update your NuGet package with:
dotnet add package Azure.AI.TextAnalytics Then, replace your old client initialization code with the new SDK syntax. The latest client now supports key phrase extraction using a simplified asynchronous call pattern:
using Azure;
using Azure.AI.TextAnalytics;
var credential = new AzureKeyCredential("<your-key>");
var client = new TextAnalyticsClient(new Uri("<your-endpoint>"), credential);
Response<KeyPhraseCollection> response = await client.ExtractKeyPhrasesAsync("Azure Cognitive Services are powerful AI tools.", "en");
foreach (string phrase in response.Value)
{
Console.WriteLine(phrase);
}
Azure.AI.TextAnalytics .NET SDK Reference
If you prefer to use the REST API instead of the SDK, the request body must now follow this unified format:
POST https://<your-language-resource-endpoint>/language/:analyze-text?api-version=2024-11-01
Content-Type: application/json
Ocp-Apim-Subscription-Key: <your-key>
{
"kind": "KeyPhraseExtraction",
"parameters": { "modelVersion": "latest" },
"analysisInput": {
"documents": [
{ "id": "1", "language": "en", "text": "Azure Text Analytics helps extract meaningful insights." }
]
}
}
Azure Language Service REST API – Analyze Text
Finally, update your Azure resource configuration by verifying the endpoint in your Azure Portal under Keys and Endpoint. Use the FQDN format such as https://<your-resource-name>.cognitiveservices.azure.com/, not the retired regional domain. Authenticate requests to Azure AI Services
I hope this is helpful! Do not hesitate to let me know if you have any other questions or clarifications.
Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.