Azure Open AI Authentication

Chinmay Ram Rangisetty 0 Reputation points
2024-12-19T05:46:51.2566667+00:00

Hi,

I'm currently working with Azure OpenAI, and for authentication, the default method is to use the keys provided for the deployed cognitive service. However, Microsoft recommends disabling local authentication (which means disabling key-based authentication).

Instead, they suggest using DefaultAzureCredential for authentication. This involves configuring the code to use DefaultAzureCredential and ensuring the correct credentials are selected.

I'm using Azure OpenAI in Synapse Analytics and want to switch to DefaultAzureCredential. Here's what I've done so far:

  1. Created a user-assigned managed identity (UDMI).
  2. Assigned the UDMI the "Cognitive Services OpenAI Contributor" role.
  3. Added the UDMI to Synapse Analytics.

However, I keep encountering an authentication error, and I'm unsure how to properly authenticate in Synapse Analytics.

If anyone has experience with this setup, could you please guide me through the process?

Thank you!

This is the error for reference.
DefaultAzureCredential failed to retrieve a token from the included credentials. Attempted credentials: EnvironmentCredential: EnvironmentCredential authentication unavailable. Environment variables are not fully configured. Visit https://aka.ms/azsdk/python/identity/environmentcredential/troubleshoot to troubleshoot this issue. ManagedIdentityCredential: ManagedIdentityCredential authentication unavailable, no response from the IMDS endpoint. SharedTokenCacheCredential: SharedTokenCacheCredential authentication unavailable. No accounts were found in the cache. AzureCliCredential: Azure CLI not found on path AzurePowerShellCredential: PowerShell is not installed AzureDeveloperCliCredential: Azure Developer CLI could not be found. Please visit https://aka.ms/azure-dev for installation instructions and then,once installed, authenticate to your Azure account using 'azd auth login'. To mitigate this issue, please refer to the troubleshooting guidelines here at https://aka.ms/azsdk/python/identity/defaultazurecredential/troubleshoot.

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
3,453 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.