# Azure OpenAI Integration with CrewAI Enterprise - Authentication Issue

Context and Setup

I’m a member of the Azure AI Founders Hub program with $5,000 in credits and am trying to integrate Azure OpenAI with CrewAI Enterprise. Despite following the setup instructions, I’m encountering authentication issues.

Current Configuration

Azure OpenAI Setup:

  • Resource Name: catheroscrewai
  • Model Deployment: gpt-4o
  • Location: East US
  • Deployment Status: Active

CrewAI Enterprise Configuration:

  1. Environment Variables Section:

    • AZURE_API_BASE
    • AZURE_API_KEY
  2. LLM Connection:

    • Provider: azure
    • Selected Model: azure/gpt-4o
    • Connection Name: CatherosCrewAI

Error Message

Error Type: AuthenticationError
Error Message: litellm.AuthenticationError: AuthenticationError: OpenAIException - Error code: 401 - {'error': {'message': 'Incorrect API key provided'}}

Steps Taken

  1. Created Azure OpenAI resource using Founders Hub credits
  2. Deployed gpt-4o model
  3. Added all required environment variables:
    • AZURE_API_BASE
    • AZURE_API_KEY
    • AZURE_API_TYPE
    • AZURE_API_VERSION
    • AZURE_DEPLOYMENT_TARGET_URL
  4. Selected azure provider in CrewAI
  5. Chose azure/gpt-4o from available models
  6. Verified API key and base URL multiple times

Questions

  1. Is there a specific format requirement for Azure OpenAI credentials in CrewAI Enterprise?
  2. Are there known issues with Azure AI Founders Hub integrations?
  3. Should the environment variables be configured differently between the top section and LLM Connection section?
  4. Are there additional steps needed for Azure OpenAI authentication?

Additional Context

  • Using Azure AI Founders Hub credits ($5,000 allocation)
  • Have access to Azure technical support through Founders Hub
  • Model deployment is confirmed working in Azure OpenAI Studio
  • All environment variables are set in both required locations

Any assistance would be greatly appreciated. Thank you!

We have a guide on our blog

Let us know how you go

Thanks, Matt, I appreciate it. I started with that guide it was great. I can’t tell if the problem is with CrewAI enterprise or Azure. I’m running into some interesting differences between your guide and my setup:

Current Configuration

  • Successfully deployed gpt-4o model in Azure AI Foundry
  • Model version: 2024-11-20
  • All environment variables set in CrewAI Enterprise:
    • AZURE_API_BASE
    • AZURE_API_KEY
    • AZURE_API_TYPE
    • AZURE_API_VERSION
    • AZURE_DEPLOYMENT_TARGET_URL

Key Differences
Your guide shows Model Deployments under Resource Management in the Azure OpenAI Studio, but I’m noticing this section isn’t visible in my interface. I’ve deployed through Azure AI Foundry instead, which seems to be the newer approach.

https://photos.app.goo.gl/DLowgZC98D6zbesu6 ← Screenshots

Current Issue
Still getting a 401 authentication error despite having:

  • Correct API key from Azure portal
  • Proper endpoint URL
  • Model deployed and showing as “Succeeded”
  • All environment variables configured in both CrewAI sections

Would appreciate any insights on whether the Azure AI Foundry deployment method requires different configuration than what’s shown in your guide, or if there are any known authentication issues when using this newer deployment approach.

Thanks for your help!

Best regards

I keep getting this error: Error Message:

litellm.AuthenticationError: AuthenticationError: OpenAIException - Error code: 401 - {‘error’: {‘message’: ‘Incorrect API key provided: 6a4JFKc8************************************************************************i13N. You can find your API key at https://platform.openai.com/account/api-keys.’, ‘type’: ‘invalid_request_error’, ‘param’: None, ‘code’: ‘invalid_api_key’}}

To be honest I do not think we have tried AI Foundry before, I will have to look into it

Thank you Matt! Would you be open to taking a look with me?

It doesn’t matter if you use AI Foundry or AI Studio, I have old and new deployments and no one works in CrewAI Enterprise. Your guide doesn’t match with CrewAI requirements, where I was asked for AZURE_DEPLOYMENT_TARGET_URL, AZURE_API_KEY and AZURE_API_VERSION, what is for API_BASE and why there is no deployment name env var key? I can select the models: azure/[model], but in Azure we name the model ourself:

https://{endpoint}/openai/deployments/{deployment-id}/completions?api-version=2024-10-21

Here my env var keys:

And for what is this part? I named my model to match the selected option: gpt-4o-2024-08-06

But I’m getting:
{“error”=>{“code”=>“404”, “message”=>“Resource not found”}}
1