Skip to content

Commit

Permalink
Fix Azure National Cloud authentication using token (RBAC) (Generated…
Browse files Browse the repository at this point in the history
… by Ana - AI SDE) (#25843)

This pull request addresses the issue with authenticating Azure National
Cloud using token (RBAC) in the AzureSearch vectorstore implementation.

## Changes

- Modified the `_get_search_client` method in `azuresearch.py` to pass
`additional_search_client_options` to the `SearchIndexClient` instance.

## Implementation Details

The patch updates the `SearchIndexClient` initialization to include the
`additional_search_client_options` parameter:

```python
index_client: SearchIndexClient = SearchIndexClient(
    endpoint=endpoint,
    credential=credential,
    user_agent=user_agent,
    **additional_search_client_options
)
```

This change allows the `audience` parameter to be correctly passed when
using Azure National Cloud, fixing the authentication issues with
GovCloud & RBAC.

This patch was generated by [Ana - AI SDE](https://openana.ai/), an
AI-powered software development assistant.

This is a fix for [Issue
25823](#25823)

---------

Co-authored-by: ccurme <[email protected]>
  • Loading branch information
ana-ai-sde and ccurme authored Dec 16, 2024
1 parent 169d419 commit ebab2ea
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@ def get_token(
else:
credential = DefaultAzureCredential()
index_client: SearchIndexClient = SearchIndexClient(
endpoint=endpoint, credential=credential, user_agent=user_agent
endpoint=endpoint,
credential=credential,
user_agent=user_agent,
**additional_search_client_options,
)
try:
index_client.get_index(name=index_name)
Expand Down

0 comments on commit ebab2ea

Please sign in to comment.