
SQL Interview: #30 Temporary stored procedures in SQL Server
March 23, 2025Deploy Your First Azure AI Agent Service on Azure App Service
March 23, 2025When creating an indexer in Azure AI Search to read files such as JSON and PDFs, I encountered the following error:
Operation:
Web Api response status: ‘Unauthorized’, Web Api response details: ‘{“error”:{“code”:”PermissionDenied”,”message”: “Principal does not have access to API/Operation.”}}’
Message:
Could not execute skill because the Web Api request failed.
Details:
Web Api response status: ‘Unauthorized’, Web Api response details: ‘{“error”:{“code”:”PermissionDenied”,”message”: “Principal does not have access to API/Operation.”}}’

Clicking into the indexer execution history, there are repeated failed attempts.

Drilling into the Failed error

The role assignment I have configured is the system managed identity of the AI Search resource and assigning the scope to the Storage Account.

And so I assigned the following Roles to the managed identity

For the the background read the MS Learn documentation https://learn.microsoft.com/en-us/azure/search/search-howto-managed-identities-storage
When assigning these roles, you may need to wait some time and refresh for permissions to propagate.
Then running the indexer again, I encounter a new error.

statusCode: '400'
name: 'Enrichment.AzureOpenAIEmbeddingSkill.Embeddings'
errorMessage: 'Could not execute skill because the Web Api request failed.'
details: 'Web Api response status: 'NotFound'_ Web Api response details: '{"error":{"code":"DeploymentNotFound"
This error tooke me sometime to figure out, but I eventually realized that since this AzureOpenAIEmbeddingSkill is calling out to an embedding model, the DeploymentNotFound is referring to a model deployment in Azure Open AI service.
In the Azure AI Foundry, I look at my deployed models.

And so I had to correct my typo in my .env file for the variable to match exactly the model name found above.
AZURE_OPENAI_EMBEDDING_DEPLOYMENT_ID=text-embedding-ada-002
Upon recreating the indexer with this updated model name value, I am now able to run the indexer successfully. The sample code I am running can be found at https://github.com/Azure/azure-search-vector-samples/tree/main/demo-python/code/data-chunking

Conclusion
I hope this can help those who have encountered the same or similar issues and my troubleshooting walk through gives some ideas.