I am getting access denial error while calling face api but I have the active subscription.

Nayeem Ahsan 0 Reputation points
2024-10-02T15:57:30.2566667+00:00

I am getting an access denial error ()401) while calling a face api but I have an active subscription. I am trying to call this api:

endpoint + f'/face/v1.0/persongroups/{person_group_id}'

This the code: create_person_group(FACE_KEY, FACE_ENDPOINT, person_group_id)

calling this method: def create_person_group(subscription_key, endpoint, person_group_id):

person_group_url = endpoint + f'/face/v1.0/persongroups/{person_group_id}'
headers = {
    'Ocp-Apim-Subscription-Key': subscription_key,
    'Content-Type': 'application/json',
    'X-MS-AZSDK-Telemetry': 'sample=create-face-collection'
}
body = {
    'name': 'my_person_group',
    'userData': 'A group of persons from an image',
    'recognitionModel': 'recognition_04'
}
response = requests.put(person_group_url, headers=headers, json=body)
try:
    response.raise_for_status()
except requests.exceptions.HTTPError as err:
    print(f"Error in create_person_group: {err.response.text}")
    raise
Azure Face
Azure Face
An Azure service that provides artificial intelligence algorithms that detect, recognize, and analyze human faces in images.
167 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.