Skip to content

Commit 1f6d780

Browse files
FDP changes
1 parent d25d3fb commit 1f6d780

File tree

14 files changed

+196
-117
lines changed

14 files changed

+196
-117
lines changed

docs/workshop/docs/workshop/Challenge-3-and-4/knowledge_mining_api.ipynb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"from azure.identity.aio import DefaultAzureCredential\n",
3232
"from azure.ai.projects import AIProjectClient\n",
3333
"from semantic_kernel.agents import AzureAIAgent\n",
34-
"from azure.ai.projects.models import TruncationObject"
34+
"from azure.ai.projects.models import TruncationObject\n",
35+
"from azure.identity import DefaultAzureCredential, get_bearer_token_provider"
3536
]
3637
},
3738
{
@@ -221,9 +222,12 @@
221222
" self,\n",
222223
" question: Annotated[str, \"the question\"]\n",
223224
" ):\n",
225+
" token_provider = get_bearer_token_provider(\n",
226+
" DefaultAzureCredential(), \"https://cognitiveservices.azure.com/.default\"\n",
227+
" )\n",
224228
" client = openai.AzureOpenAI(\n",
225229
" azure_endpoint=self.azure_openai_endpoint,\n",
226-
" api_key=self.azure_openai_api_key,\n",
230+
" azure_ad_token_provider=token_provider,\n",
227231
" api_version=self.azure_openai_api_version\n",
228232
" )\n",
229233
"\n",

infra/deploy_ai_foundry.bicep

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ resource azureOpenAIEndpointEntry 'Microsoft.KeyVault/vaults/secrets@2021-11-01-
413413
parent: keyVault
414414
name: 'AZURE-OPENAI-ENDPOINT'
415415
properties: {
416-
value: aiServices.properties.endpoint //aiServices_m.properties.endpoint
416+
value: aiServices.properties.endpoints['OpenAI Language Model Instance API'] //aiServices_m.properties.endpoint
417417
}
418418
}
419419

@@ -429,7 +429,7 @@ resource azureOpenAICUEndpointEntry 'Microsoft.KeyVault/vaults/secrets@2021-11-0
429429
parent: keyVault
430430
name: 'AZURE-OPENAI-CU-ENDPOINT'
431431
properties: {
432-
value: aiServices_CU.properties.endpoint
432+
value: aiServices_CU.properties.endpoints['OpenAI Language Model Instance API']
433433
}
434434
}
435435

infra/deploy_backend_docker.bicep

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ param solutionLocation string
77
@secure()
88
param appSettings object = {}
99
param appServicePlanId string
10-
@secure()
11-
param azureAiProjectConnString string
1210
param userassignedIdentityId string
1311
param aiProjectName string
1412
param keyVaultName string
@@ -91,8 +89,7 @@ module appService 'deploy_app_service.bicep' = {
9189
userassignedIdentityId:userassignedIdentityId
9290
appSettings: union(
9391
appSettings,
94-
{
95-
AZURE_AI_PROJECT_CONN_STRING:azureAiProjectConnString
92+
{
9693
APPINSIGHTS_INSTRUMENTATIONKEY: reference(applicationInsightsId, '2015-05-01').InstrumentationKey
9794
REACT_APP_LAYOUT_CONFIG: reactAppLayoutConfig
9895
}
@@ -119,8 +116,13 @@ resource role 'Microsoft.DocumentDB/databaseAccounts/sqlRoleAssignments@2022-05-
119116
}
120117
}
121118

119+
resource aiServices 'Microsoft.CognitiveServices/accounts@2025-04-01-preview' existing = {
120+
name: aiServicesName
121+
}
122+
122123
resource aiProject 'Microsoft.CognitiveServices/accounts/projects@2025-04-01-preview' existing = {
123-
name: '${aiServicesName}/${aiProjectName}'
124+
parent: aiServices
125+
name: aiProjectName
124126
}
125127

126128
resource aiDeveloper 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = {
@@ -153,6 +155,28 @@ resource keyVaultSecretsUserAssignment 'Microsoft.Authorization/roleAssignments@
153155
}
154156
}
155157

158+
resource aiUser 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = {
159+
name: '53ca6127-db72-4b80-b1b0-d745d6d5456d'
160+
}
161+
162+
resource aiUserAccessProj 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
163+
name: guid(appService.name, aiProject.id, aiUser.id)
164+
scope: aiProject
165+
properties: {
166+
roleDefinitionId: aiUser.id
167+
principalId: appService.outputs.identityPrincipalId
168+
}
169+
}
170+
171+
resource aiUserAccessFoundry 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
172+
name: guid(appService.name, aiServices.id, aiUser.id)
173+
scope: aiServices
174+
properties: {
175+
roleDefinitionId: aiUser.id
176+
principalId: appService.outputs.identityPrincipalId
177+
}
178+
}
179+
156180
output appUrl string = appService.outputs.appUrl
157181
output reactAppLayoutConfig string = reactAppLayoutConfig
158182
output appInsightInstrumentationKey string = reference(applicationInsightsId, '2015-05-01').InstrumentationKey

infra/main.bicep

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ param gptModelName string = 'gpt-4o-mini'
4040
// @minLength(1)
4141
// @description('Version of the GPT model to deploy:')
4242
// param gptModelVersion string = '2024-02-15-preview' //'2024-08-06'
43-
var azureOpenAIApiVersion = '2024-02-15-preview'
43+
var azureOpenAIApiVersion = '2025-01-01-preview'
4444

4545
@minValue(10)
4646
@description('Capacity of the GPT deployment:')
@@ -196,7 +196,6 @@ module backend_docker 'deploy_backend_docker.bicep' = {
196196
imageTag: imageTag
197197
appServicePlanId: hostingplan.outputs.name
198198
applicationInsightsId: aifoundry.outputs.applicationInsightsId
199-
azureAiProjectConnString: keyVault.getSecret('AZURE-AI-PROJECT-CONN-STRING')
200199
userassignedIdentityId: managedIdentityModule.outputs.managedIdentityBackendAppOutput.id
201200
aiProjectName: aifoundry.outputs.aiProjectName
202201
keyVaultName: kvault.outputs.keyvaultName
@@ -207,6 +206,8 @@ module backend_docker 'deploy_backend_docker.bicep' = {
207206
AZURE_OPENAI_API_VERSION: azureOpenAIApiVersion
208207
AZURE_OPENAI_RESOURCE: aifoundry.outputs.aiServicesName
209208
AZURE_OPENAI_API_KEY: '@Microsoft.KeyVault(SecretUri=${kvault.outputs.keyvaultUri}secrets/AZURE-OPENAI-KEY/)'
209+
AZURE_AI_AGENT_ENDPOINT: aifoundry.outputs.projectEndpoint
210+
AZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME: gptModelName
210211
USE_CHAT_HISTORY_ENABLED: 'True'
211212
AZURE_COSMOSDB_ACCOUNT: cosmosDBModule.outputs.cosmosAccountName
212213
AZURE_COSMOSDB_CONVERSATIONS_CONTAINER: cosmosDBModule.outputs.cosmosContainerName
@@ -279,6 +280,8 @@ output SQLDB_USERNAME string = sqlDBModule.outputs.sqlDbUser
279280
output USE_AI_PROJECT_CLIENT string = 'False'
280281
output USE_CHAT_HISTORY_ENABLED string = 'True'
281282
output DISPLAY_CHART_DEFAULT string = 'False'
283+
output AZURE_AI_AGENT_ENDPOINT string = aifoundry.outputs.projectEndpoint
284+
output AZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME string = gptModelName
282285

283286
output API_APP_URL string = backend_docker.outputs.appUrl
284287
output WEB_APP_URL string = frontend_docker.outputs.appUrl

0 commit comments

Comments
 (0)