Skip to content

project.inference.get_chat_completions_client() not working - Principal does not have access to API/Operation. #40297

Closed
@jakeatmsft

Description

@jakeatmsft

Name: azure-ai-inference
Version: 1.0.0b8
Summary: Microsoft Azure AI Inference Client Library for Python
Home-page: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ai/azure-ai-inference
Author: Microsoft Corporation
Author-email: azpysdkhelp@microsoft.com
License: MIT License
Location: C:\Users\jacwang\AppData\Local\anaconda3\envs\lab\Lib\site-packages
Requires: azure-core, isodate, typing-extensions
Required-by:

When running following ecample:
https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-projects/samples/inference/sample_chat_completions_with_azure_ai_inference_client.py

  chat = project.inference.get_chat_completions_client() # Error here
    messages = [
        {
            "role": "system",
            "content": "You are an AI assistant that tells jokes for toddlers.",
        },
        {"role": "user", "content": "Hey, can you tell a joke about teddy bear?"},
    ]
    print(f"Sending request to model '{model}' with messages: {messages}")
    
    response = chat.complete(
        model=model,
        messages=messages,
    )

I get the following error:
ClientAuthenticationError: (PermissionDenied) Principal does not have access to API/Operation.
Code: PermissionDenied
Message: Principal does not have access to API/Operation.

Permissions granted:
User -

  • Owner - Everything
  • AI Developer - AI Service
  • Azure OpenAI User - AI Service

Project (SMI)

  • AI Developer - AI Service

Hub (SMI)

  • AI Developer - AI Service

Expected behavior
Expected completion returned.

Metadata

Metadata

Assignees

Labels

AI Model InferenceIssues related to the client library for Azure AI Model Inference (\sdk\ai\azure-ai-inference)ClientThis issue points to a problem in the data-plane of the library.Service AttentionWorkflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-author-feedbackWorkflow: More information is needed from author to address the issue.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions