Courseiva

AI-102 Practice Question: Implement natural language processing solutions

Network Topology
az cognitiveservices account showname myTextAnalyticsresource-group myResourceGroupquery "properties.endpoint""key1": "abc123def456","key2": "789ghi012jkl""https://mytextanalytics.cognitiveservices.azure.com/"

Refer to the exhibit. A developer is testing the Text Analytics sentiment analysis API and receives a 401 error. What is the most likely cause?

⚠ Common exam trap

AI-102 often tests HTTP status code semantics — candidates see 'endpoint URL is incorrect' and pick it because endpoint issues feel more common, but 401 is strictly an authentication failure, not a routing or versioning failure.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

The subscription key is invalid or expired.

HTTP 401 Unauthorized specifically means the request lacked valid authentication credentials — for Azure Cognitive Services Text Analytics, that means the Ocp-Apim-Subscription-Key header is missing, malformed, or the key has been regenerated/expired. The endpoint and API version are validated separately (404/400), and resource group naming is irrelevant to runtime API calls. Therefore the invalid or expired subscription key is the most likely cause.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    The API version is not supported.

    Why it's wrong here

    An unsupported API version returns 400 with an explicit version error, not 401, which specifically indicates the subscription key or bearer token was rejected. Version mismatches are tempting because they break requests during upgrades, and pinning a supported api-version would be correct when the service reports an invalid version.

  • ✗

    The endpoint URL is incorrect.

    Why it's wrong here

    A wrong endpoint typically yields 404 or DNS failure, not 401, which signals rejected credentials or a missing/invalid subscription key header. It is tempting because endpoint misconfiguration is a common setup error, and correcting the URL would be the right fix when the service returns resource-not-found responses.

  • ✗

    The resource group is misspelled.

    Why it's wrong here

    A misspelled resource group name produces a 404 resource-not-found response, since the endpoint path cannot be resolved. A 401 indicates the request reached the service but authentication failed, typically an invalid or missing subscription key or endpoint credential.

  • ✓

    The subscription key is invalid or expired.

    Why this is correct

    A 401 response signals failed authentication, and the Text Analytics API authenticates requests solely via the Ocp-Apim-Subscription-Key header. An invalid, expired, or mistyped subscription key therefore causes the rejection, whereas malformed JSON or an unsupported language would return 400 errors instead.

About these practice questions

This AI-102 question is part of Courseiva's 761-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Microsoft exam blueprint

This AI-102 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AI-102 exam.