Skip to content

Commit d8d0133

Browse files
committed
Update
1 parent 041fa38 commit d8d0133

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

deploy_ai_search/src/deploy_ai_search/environment.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,11 @@ def ai_search_credential(self) -> DefaultAzureCredential | AzureKeyCredential:
109109
Returns:
110110
DefaultAzureCredential | AzureKeyCredential: The ai search credential
111111
"""
112-
if self.identity_type == IdentityType.SYSTEM_ASSIGNED:
112+
if self.identity_type in [
113+
IdentityType.SYSTEM_ASSIGNED,
114+
IdentityType.USER_ASSIGNED,
115+
]:
113116
return DefaultAzureCredential()
114-
elif self.identity_type == IdentityType.USER_ASSIGNED:
115-
return DefaultAzureCredential(
116-
managed_identity_client_id=self.ai_search_identity_id
117-
)
118117
else:
119118
return AzureKeyCredential(
120119
os.environ.get("AIService__AzureSearchOptions__Key")
@@ -180,7 +179,7 @@ def storage_account_blob_container_name(self) -> str:
180179
if container is None:
181180
raise ValueError(
182181
f"""Populate environment variable 'StorageAccount__{
183-
self.normalised_indexer_type}__Container' with container name."""
182+
self.normalised_indexer_type}__Container' with container name."""
184183
)
185184

186185
return container

text_2_sql/text_2_sql_core/src/text_2_sql_core/connectors/open_ai.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,15 @@
1212
class OpenAIConnector:
1313
@classmethod
1414
def get_authentication_properties(cls) -> dict:
15-
if get_identity_type() == IdentityType.SYSTEM_ASSIGNED:
15+
if get_identity_type() in [
16+
IdentityType.SYSTEM_ASSIGNED,
17+
IdentityType.USER_ASSIGNED,
18+
]:
1619
# Create the token provider
1720
api_key = None
1821
token_provider = get_bearer_token_provider(
1922
DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default"
2023
)
21-
elif get_identity_type() == IdentityType.USER_ASSIGNED:
22-
# Create the token provider
23-
api_key = None
24-
token_provider = get_bearer_token_provider(
25-
DefaultAzureCredential(
26-
managed_identity_client_id=os.environ["ClientId"]
27-
),
28-
"https://cognitiveservices.azure.com/.default",
29-
)
3024
else:
3125
token_provider = None
3226
api_key = os.environ["OpenAI__ApiKey"]

0 commit comments

Comments
 (0)