Error code: 400 - {'error': {'requestid': 'code': 400, 'message': "Invalid AzureCognitiveSearch configuration detected: Call to get Azure Search index failed.

Vijay Gawte 20 Reputation points
2025-02-06T10:49:18.01+00:00

Hello,

I have Virtual machine created in azure, I am trying to access azure open ai and azure search service from virtual machine but it is giving below error Exception Error code: 400 - {'error': {'requestid': '9ad0e3db-ef59-4ffc-9237-fd5970e39c74', 'code': 400, 'message': "Invalid AzureCognitiveSearch configuration detected: Call to get Azure Search index failed. Check if you are using the correct Azure Search endpoint and index name. If you are using key based authentication, check if the admin key is correct. If you are using access token authentication or managed identity of Azure OpenAI, check if the Azure Search has enabled RBAC based authentication and if the user identity or Azure OpenAI managed identity has required role assignments to access Azure Search resource [https://aka.ms/aoaioydauthentication]. If the Azure Search resource has no public network access, make sure enable trusted service of Azure Search.\nAzure Search Error: 403, message='Server responded with status 403.

I have whitelisted Azure VM public IP in open ai and search service networking, but when I am making it public accessible, it is working (I can access both services from VM)

Can anyone help me here?

###################### 2nd issue:

I have tried securing both the services using private endpoints, but still I am getting the above search service error. I have tried to ping private endpoints from Azure VM, and it is resolving the private endpoint IP address.

To again confirm, I created a simple Python script to call the open AI service using the key and endpoint, and I was able to get the response from the VM, but the issue seems to be in the search service.

Am I missing any part while creating a private endpoint for the search service? (I have selected resource as searchservice while creating private endpoint for search service.)

Azure AI Search
Azure AI Search
An Azure search service with built-in artificial intelligence capabilities that enrich information to help identify and explore relevant content at scale.
1,232 questions
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
3,819 questions
{count} votes

Accepted answer
  1. JAYA SHANKAR G S 1,450 Reputation points Microsoft External Staff
    2025-02-11T12:33:49.3266667+00:00

    Hi Vijay Gawte,

    You grant access to trusted services on both ai search and open ai.

    In openai

    enter image description here

    and in search service.

    enter image description here

    Next, enable managed identity in azure openai and assign

    Search Service Contributor role to it, because

    When you send API calls to chat with an Azure OpenAI model on your data, the service needs to retrieve the index fields during inference to perform fields mapping. Therefore the service requires the Azure OpenAI identity to have the Search Service Contributor role for the search service even during inference.

    Check this documentation.

    Enable system managed identity.

    enter image description here

    and role assignments

    enter image description here

    Then you make chat completion with authentication type to search service like below.

    "data_sources": [
    
                {
    
                    "type": "azure_search",
    
                    "parameters": {
    
                        "endpoint": search_endpoint,
    
                        "index_name": search_index,
    
                        "authentication": {
    
                            "type": "system_assigned_managed_identity"
    
                        }
    
                    }
    
                }
    
            ]
    

    UPDATE

    According to this documentation to use the vector search without api key and public access disabled, use below embedding dependency in data source.

    "embedding_dependency": {
                  "type": "deployment_name",
                    "deployment_name":"text-embedding-ada-002" #Your embedding deployment name
                }
    

    Hope above steps helps to solve your issue. Please don't forget accept the answer and give feedback by clicking on yes.

    Thank you

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

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.