vscode-ai-toolkit icon indicating copy to clipboard operation
vscode-ai-toolkit copied to clipboard

Need support for Microsoft Intra ID authentication

Open wanbao118 opened this issue 1 year ago • 4 comments

I have Azure OpenAI deployments on Azure AI Foundry in my organization, we have disabled key based authentication as it is considered insecure, please can you consider to support Azure EntraID authentication?

wanbao118 avatar Feb 06 '25 07:02 wanbao118

Hi @wanbao118 , could you help elaborate how you are using Azure AI Foundry models in AI Toolkit right now?

MuyangAmigo avatar Feb 25 '25 07:02 MuyangAmigo

Hi @MuyangAmigo due to our organizational security policy, LLMs deployed on Azure AI Foundry should have API Key based authentication disabled, so normally I can't use our deployments with this VS Code AI Toolkit plugin, but I have to programmatically use Azure SDK to connect to LLMs, below is something works for me in our company. eg. Using Azure SDK with azure credential provider, so that I can just login Azure by issuing az login, then connect to LLM by running below code. https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/managed-identity

from azure.identity import DefaultAzureCredential, get_bearer_token_provider
from openai import AzureOpenAI

token_provider = get_bearer_token_provider(
    DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default"
)

client = AzureOpenAI(
    api_version="2024-02-15-preview",
    azure_endpoint="https://{your-custom-endpoint}.openai.azure.com/",
    azure_ad_token_provider=token_provider
)

response = client.chat.completions.create(
    model="gpt-35-turbo-0125", # model = "deployment_name".
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Does Azure OpenAI support customer managed keys?"},
        {"role": "assistant", "content": "Yes, customer managed keys are supported by Azure OpenAI."},
        {"role": "user", "content": "Do other Azure AI services support this too?"}
    ]
)

print(response.choices[0].message.content)

wanbao118 avatar Mar 16 '25 04:03 wanbao118

Same issue. Is there any plan to support ID authentication?

funtion avatar Apr 20 '25 13:04 funtion

Our organisation also has the same issue

keanughorbanian-sb avatar Jun 25 '25 14:06 keanughorbanian-sb