Permission Denied fpr Microsoft Cmputer vision with ocrrect credentials

A. Nohl 0 Reputation points
2024-06-17T16:26:24.6966667+00:00

I am trying to access the Computer Vision model over the Student Azure subscription. I checked the Credentials so the subscription key and the endpoint should be correct, I copied them out of the keys and endpoint tab.
I call the client like this and access the data:

client = ComputerVisionClient(endpoint, CognitiveServicesCredentials(subscription_key))
response = client.read_in_stream(io.BytesIO(image), raw=True)
def analyze_images(images):
    results = []
    for image in images:
        response = client.read_in_stream(io.BytesIO(image), raw=True)
        operation_location = response.headers["Operation-Location"]
        operation_id = operation_location.split("/")[-1]

        # Wait for the operation to complete
        while True:
            result = client.get_read_result(operation_id)
            if result.status.lower() not in ["notstarted", "running"]:
                break
            time.sleep(1)

        if result.status == OperationStatusCodes.succeeded:
            results.append(result.analyze_result.read_results)
    return results
response = client.read_in_stream(io.BytesIO(image), raw=True)

I use the F0 pricing where OCR should be included and i am also owner of the project.User's imageUser's image

Thank you already a lot in advance!

Azure Computer Vision
Azure Computer Vision
An Azure artificial intelligence service that analyzes content in images and video.
341 questions
{count} votes

1 answer

Sort by: Most helpful
  1. VasaviLankipalle-MSFT 15,861 Reputation points
    2024-06-18T05:06:19.8066667+00:00

    Hello @A. Nohl , Thanks for using Microsoft Q&A Platform.

    Make sure you have all the has the necessary permissions and roles (ex: "Cognitive Services User, contributor") to access the Computer Vision API.

    Please refer to this documentation and add the necessary roles: https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#ai--machine-learning

    I hope this helps.

    Regards,

    Vasavi

    -Please kindly accept the answer and vote 'yes' if you feel helpful to support the community, thanks.

    0 comments No comments