HttpResponseError: Operation returned an invalid status 'Forbidden' when creating search index using Azure AI SearchIndexClient()

Das Gupta, Abhijeet 55 Reputation points
2024-05-21T11:10:34.2066667+00:00

I've followed a post(link below) in which the same issue was faced while creating a search index.
https://learn.microsoft.com/en-us/answers/questions/1640592/error-when-creating-azure-ai-search-index-with-rol

index = SearchIndex(name=index_name, fields=fields, vector_search=vector_search, semantic_search=semantic_search)
result = index_client.create_or_update_index(index)

HttpResponseError: Operation returned an invalid status 'Forbidden'

I have assigned "Search Index Contributor" role to myself for the Azure AI search resource. In the linked post, the user solved the issue by assigning the mentioned role along with setting up an environment variable for the compute which confuses me.

os.environ['AZURE_CLIENT_ID'] = '<client id of the compute>'

How do I determine the information for this environment variable?

Also, do I assign myself the Search Index Contributor for Azure AI Studio resource?

For context, I'm creating prompt flows in Azure AI studio and would be needing to call the SearchClientIndex() using the compute instance created using the Azure AI studio.

TIA

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
2,630 questions
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.
768 questions
Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
2,468 questions
{count} votes