Skip to main content
Face detection with Azure AI Vision (Face API) lets you detect and analyze faces in images. The API locates faces, returns bounding boxes and landmarks (eye centers, nose tip, lip corners), and can optionally return attributes such as head pose, glasses, and more. Note that certain capabilities—like identity matching and some sensitive attributes (age, gender, emotion)—require explicit approval for your Azure subscription.
Some attributes (for example: age, gender, emotions, and identity matching/Face ID) require extra approval from Microsoft before they can be used. You can still retrieve landmarks and basic location data without that approval.
A presentation slide titled "Face Detection Using Azure AI Vision" explaining the Face API's ability to detect and analyze faces. It includes a smartphone illustration showing a detected face and two numbered notes about using the Face endpoint and possible extra approval for recognition/identification features.
What the Face API can return
  • Bounding boxes for each detected face.
  • Detailed facial landmarks (eyes, nose, mouth, pupils, etc.).
  • Optional face attributes (head pose, glasses, and other attributes where allowed).
  • Optional unique face identifiers for cross-image matching (subject to approval).
Optional request parameters (quick overview)
A presentation slide titled "Face Detection Using Azure AI Vision" that lists three optional request parameters — returnFaceId, returnFaceLandmarks, and returnFaceAttributes — each with a brief description. The slide has a dark teal background with rounded rectangular bullets and a small KodeKloud copyright.
Additional optional parameters
A slide titled "Face Detection Using Azure AI Vision" listing three optional request parameters—recognitionModel, returnRecognitionModel, and detectionModel—with short descriptions for each.
API response structure When faces are detected, the Face API returns a JSON array where each element corresponds to one detected face. Key fields include:
A dark-themed presentation slide titled "Face Detection Using Azure AI Vision" showing an "API Response" button and three icons labeled "FaceId," "Bounding box coordinates," and "Landmarks" that illustrate the structured JSON output.
Example: simplified REST detect request and a trimmed JSON response
Create and configure the Face resource in Azure Portal
  1. In the Azure Portal, create an Azure AI (Face) resource. Provide subscription, resource group, region, name, and pricing tier. Note: the free tier is limited to one per subscription and may not always be available.
  2. After creation, open the resource and copy the service endpoint and subscription keys from the “Keys and Endpoint” blade. You’ll use these values in SDKs and REST calls.
A screenshot of the Microsoft Azure portal showing the "Create Face" resource form with fields for subscription, resource group, region, instance name, and pricing tier. The page includes navigation tabs and a pricing dropdown open near the bottom.
A screenshot of the Microsoft Azure portal showing the "ai900-face-recog | Keys and Endpoint" page for the Face API, with masked keys, Location/Region set to "eastus," and the service endpoint URL displayed. The Azure left-hand navigation menu and top browser tabs are also visible.
Python examples (Azure Face SDK) Below are concise Python examples using the Azure Cognitive Services Face SDK. Replace the endpoint and key placeholders with values from your Azure resource. Single-image example (detect faces and landmarks, without returning Face ID)
Typical cleaned console output (example):
Group image (multiple faces) To analyze group images, provide a group image URL. The API response will return one object per detected face in the array.
Tips, notes, and troubleshooting
  • If you request face IDs or certain attributes and your subscription lacks approval, the service may return an error—disable those parameters or request access via Azure support.
  • Use returnRecognitionModel for traceability when running experiments across SDK versions.
  • Verify pricing tier and quotas (especially in production) to avoid throttling.
  • For persistent matching across images, you need faceId functionality and the appropriate approval.
  • If you get permissions errors for sensitive attributes, file an Azure support request to request feature access.
  • When debugging, log the recognitionModel and detectionModel returned so you can reproduce results later.
Resources and references With these steps and examples you can detect faces, extract landmarks, and request face attributes where allowed. Explore the broader Azure Vision documentation for additional capabilities like OCR, object detection, and custom vision scenarios.

Watch Video