Face Detection, Verification and Liveness
|
This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. See the section bibliography for the reference material consulted while preparing these pages. |
This page targets Azure CLI 2.90.0 and the Face REST API v1.2. The Face client libraries are still preview:
azure-ai-vision-face 1.0.0b2 (Python), Azure.AI.Vision.Face 1.0.0-beta.2 (.NET) and
com.azure:azure-ai-vision-face 1.0.0-beta.2 (Java), checked on 2026-10-06. There is no GA Java SDK, so this page
shows Python, C# and REST.
Azure Face in Foundry Tools (part of Azure Vision) detects human faces in images and, for approved customers, compares them. Face is the most restricted tool in the catalog. Read the Limited Access rules before you design anything around it.
Bookshelf doesn’t use Face
Bookshelf deliberately does not use Face. A bookshop has no need to identify or verify people from images, and adding biometric processing would bring consent, retention and legal obligations with no benefit to readers. The examples on this page use a generic KYC (know your customer) onboarding scenario for a regulated business instead.
Operations
| Operation | What it does |
|---|---|
Detect |
Finds faces and returns a bounding box, landmarks, head pose, blur, exposure, occlusion, glasses, mask and a quality score for recognition. Available to everyone. |
Verify (1:1) |
Do two faces belong to the same person? Limited Access. |
Identify (1:N) |
Which person in a person group (or large person group) is this? Limited Access. |
Find similar |
Faces that look like a query face, in a face list. Limited Access. |
Group |
Clusters unknown faces by similarity. Limited Access. |
Liveness detection |
Is this a live person in front of the camera, not a photo, screen or mask? Uses a client SDK (iOS, Android, web) plus a server-side session. Liveness with verification also compares the live face to a reference photo. |
Source: What is Azure Face?
Limited Access, attributes and prohibited uses
-
Limited Access: identification, verification, find similar, group and liveness with verification are available only to Microsoft-managed customers and partners whose use case is approved through the Face intake form.
-
Retired attributes: emotion, gender, age, smile, facial hair, hair and makeup were removed from detection.
-
Limited attributes: glasses, mask, head pose, blur, exposure, noise and occlusion remain, mainly to judge image quality.
-
Prohibited uses include use by or for a police department in the United States for facial recognition, and real-time identification in uncontrolled public spaces.
-
Input limits: JPEG, PNG, GIF or BMP; up to 6 MB; faces at least 36 x 36 pixels (200 x 200 for best results); up to 100 faces per image; 1 million persons per large person group.
Source: Limited Access features
Provisioning
In the Azure portal
-
Create a single-service
Faceresource (or use the Foundry resource) in a supported region. -
Submit the Face Limited Access intake form, linked from the resource’s overview, before using verification, identification or liveness with verification.
-
In the Foundry portal, Playgrounds → Vision playground → Face tries detection and liveness.
-
Assign
Cognitive Services Face Recognizerto the identity that calls Face.
Detection
from azure.ai.vision.face import FaceClient
from azure.ai.vision.face.models import (
FaceDetectionModel, FaceRecognitionModel, FaceAttributeTypeDetection03,
)
from azure.identity import DefaultAzureCredential
client = FaceClient("https://face-kyc-demo.cognitiveservices.azure.com/", DefaultAzureCredential())
with open("id-photo.jpg", "rb") as f:
faces = client.detect(
f.read(),
detection_model=FaceDetectionModel.DETECTION03,
recognition_model=FaceRecognitionModel.RECOGNITION04,
return_face_id=False,
return_face_attributes=[FaceAttributeTypeDetection03.QUALITY_FOR_RECOGNITION, FaceAttributeTypeDetection03.BLUR],
)
for face in faces:
print(face.face_rectangle, face.face_attributes.quality_for_recognition)
Source: Face quickstart (Python)
using Azure.AI.Vision.Face;
using Azure.Identity;
var client = new FaceClient(
new Uri("https://face-kyc-demo.cognitiveservices.azure.com/"), new DefaultAzureCredential());
var response = await client.DetectAsync(
BinaryData.FromBytes(await File.ReadAllBytesAsync("id-photo.jpg")),
FaceDetectionModel.Detection03, FaceRecognitionModel.Recognition04,
returnFaceId: false,
returnFaceAttributes: new[] { FaceAttributeType.QualityForRecognition });
foreach (FaceDetectionResult face in response.Value)
Console.WriteLine($"{face.FaceRectangle.Width}x{face.FaceRectangle.Height} {face.FaceAttributes.QualityForRecognition}");
Source: Face quickstart (C#)
KYC onboarding with liveness
A bank’s app onboards a customer remotely: the customer photographs an ID document, then takes a live selfie. The server checks that the selfie is live and matches the ID photo, in one liveness-with-verification session.
The session token gives the device no access to results, so a tampered app can’t fake an approval. The decision is read only by the server.
TOKEN=$(az account get-access-token --resource https://cognitiveservices.azure.com --query accessToken -o tsv)
curl -s -X POST \
"https://face-kyc-demo.cognitiveservices.azure.com/face/v1.2/detectLivenessWithVerify-sessions" \
-H "Authorization: Bearer $TOKEN" \
-F 'Parameters={"livenessOperationMode":"PassiveActive","deviceCorrelationId":"device-7f3a"};type=application/json' \
-F "VerifyImage=@id-photo.jpg"
curl -s "https://face-kyc-demo.cognitiveservices.azure.com/face/v1.2/detectLivenessWithVerify-sessions/$SESSION_ID" \
-H "Authorization: Bearer $TOKEN" | jq '.results.attempts[-1].result'
Source: Face liveness detection tutorial
from azure.ai.vision.face import FaceSessionClient
from azure.ai.vision.face.models import CreateLivenessWithVerifySessionContent, LivenessOperationMode
sessions = FaceSessionClient("https://face-kyc-demo.cognitiveservices.azure.com/", DefaultAzureCredential())
with open("id-photo.jpg", "rb") as ref:
created = sessions.create_liveness_with_verify_session(
CreateLivenessWithVerifySessionContent(liveness_operation_mode=LivenessOperationMode.PASSIVE_ACTIVE),
verify_image=ref,
)
print(created.session_id) # send created.auth_token to the device
Source: Face liveness detection tutorial
Use cases
| Scenario | Feature | Why this feature | Example input → output |
|---|---|---|---|
KYC onboarding (finance) |
Liveness with verification (Limited Access) |
Remote identity proofing; spoof resistance. |
ID photo + live selfie → |
Touchless building access |
Identify against a large person group (Limited Access) |
Employees enroll once; doors open on approach. |
Camera frame → |
Face blurring for privacy |
Detect only (open to everyone) |
Find faces to blur in published photos; no identification. |
Event photo → bounding boxes to blur |
Photo de-duplication |
Find similar or group (Limited Access) |
Clean up a member photo library. |
Library → clusters of the same person |
Bookshelf |
Not used |
No business need for biometrics; see the section above. |
— |
When not to use it
-
When you only need to know whether an image contains people, Image Analysis
peopleor a Foundry Model is enough, and avoids biometric processing. -
For moderating profile pictures, use Content Safety.
-
Never use Face to infer emotion, gender or age; those attributes were retired.
-
See Choosing a Foundry Tool (or a Foundry Model) for alternatives.
Clean up
az cognitiveservices account delete --name face-kyc-demo --resource-group rg-kyc-demo
az group delete --name rg-kyc-demo --yes --no-wait
Delete person groups and face lists you no longer need; Face stores enrolled face templates until you delete them.
Related pages
-
Networking, Security and Responsible AI covers Limited Access and transparency notes.
-
Vision: Image Analysis and OCR covers the rest of Azure Vision.
-
Responsible AI Practices covers impact assessment for sensitive uses.