Skip to content

Commit 426b0cf

Browse files
authored
Merge pull request #1330 from b4s36t4/fix/azure-ai-entra-scope
fix: accept scope from request headers to allow azure serverless infe…
2 parents 4851bd3 + d3bbd19 commit 426b0cf

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

src/handlers/handlerUtils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,7 @@ export function constructConfigFromRequestHeaders(
866866
azureEntraClientSecret:
867867
requestHeaders[`x-${POWERED_BY}-azure-entra-client-secret`],
868868
azureEntraTenantId: requestHeaders[`x-${POWERED_BY}-azure-entra-tenant-id`],
869+
azureEntraScope: requestHeaders[`x-${POWERED_BY}-azure-entra-scope`],
869870
};
870871

871872
const awsConfig = {

src/providers/azure-ai-inference/api.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,15 @@ const AzureAIInferenceAPI: ProviderAPIConfig = {
6565
}
6666

6767
if (azureAuthMode === 'entra') {
68-
const { azureEntraTenantId, azureEntraClientId, azureEntraClientSecret } =
69-
providerOptions;
68+
const {
69+
azureEntraTenantId,
70+
azureEntraClientId,
71+
azureEntraClientSecret,
72+
azureEntraScope,
73+
} = providerOptions;
7074
if (azureEntraTenantId && azureEntraClientId && azureEntraClientSecret) {
71-
const scope = 'https://cognitiveservices.azure.com/.default';
75+
const scope =
76+
azureEntraScope ?? 'https://cognitiveservices.azure.com/.default';
7277
const accessToken = await getAccessTokenFromEntraId(
7378
azureEntraTenantId,
7479
azureEntraClientId,

src/types/requestBody.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ export interface Options {
157157

158158
/** Cortex specific fields */
159159
snowflakeAccount?: string;
160+
161+
/** Azure entra scope */
162+
azureEntraScope?: string;
160163
}
161164

162165
/**

0 commit comments

Comments
 (0)