Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions infra/deploy_ai_foundry.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ param gptModelName string
param gptModelVersion string
param managedIdentityObjectId string
param aiServicesEndpoint string
param aiServices object
param aiServicesKey string
param aiServicesId string

var storageName = '${solutionName}hubstorage'
Expand Down Expand Up @@ -133,11 +133,8 @@ resource aiHub 'Microsoft.MachineLearningServices/workspaces@2023-08-01-preview'
properties: {
category: 'AIServices'
target: aiServicesEndpoint
authType: 'ApiKey'
authType: 'AAD'
isSharedToAll: true
credentials: {
key: aiServices.Key.key1
}
metadata: {
ApiType: 'Azure'
ResourceId: aiServicesId
Expand All @@ -159,6 +156,19 @@ resource aiHubProject 'Microsoft.MachineLearningServices/workspaces@2024-01-01-p
}
}

resource aiDeveloper 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = {
name: '64702f94-c441-49e6-a78b-ef80e0188fee'
}

resource aiDevelopertoAIProject 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(aiHubProject.id, aiDeveloper.id)
scope: resourceGroup()
properties: {
roleDefinitionId: aiDeveloper.id
principalId: aiHubProject.identity.principalId
}
}

resource tenantIdEntry 'Microsoft.KeyVault/vaults/secrets@2021-11-01-preview' = {
parent: keyVault
name: 'TENANT-ID'
Expand Down Expand Up @@ -187,7 +197,7 @@ resource azureOpenAIApiKeyEntry 'Microsoft.KeyVault/vaults/secrets@2021-11-01-pr
parent: keyVault
name: 'AZURE-OPENAI-KEY'
properties: {
value: aiServices.Key.key1 //aiServices_m.listKeys().key1
value: aiServicesKey //aiServices_m.listKeys().key1
}
}

Expand Down Expand Up @@ -251,7 +261,7 @@ resource cogServiceKeyEntry 'Microsoft.KeyVault/vaults/secrets@2021-11-01-previe
parent: keyVault
name: 'COG-SERVICES-KEY'
properties: {
value: aiServices.Key.key1
value: aiServicesKey
}
}

Expand Down
2 changes: 1 addition & 1 deletion infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ module aifoundry 'deploy_ai_foundry.bicep' = {
gptModelVersion: gptModelVersion
managedIdentityObjectId: managedIdentityModule.outputs.managedIdentityOutput.objectId
aiServicesEndpoint: aiServices.properties.endpoint
aiServices: aiServices
aiServicesKey: aiServices.listKeys().key1
aiServicesId: aiServices.id
}
scope: resourceGroup(resourceGroup().name)
Expand Down
21 changes: 15 additions & 6 deletions infra/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"_generator": {
"name": "bicep",
"version": "0.35.1.17967",
"templateHash": "18228555099764132241"
"templateHash": "4778084734742710121"
}
},
"parameters": {
Expand Down Expand Up @@ -712,7 +712,7 @@
"_generator": {
"name": "bicep",
"version": "0.35.1.17967",
"templateHash": "9490638595753234802"
"templateHash": "14561153070486462167"
}
},
"parameters": {
Expand Down Expand Up @@ -767,11 +767,8 @@
"properties": {
"category": "AIServices",
"target": "[parameters('aiServicesEndpoint')]",
"authType": "ApiKey",
"authType": "AAD",
"isSharedToAll": true,
"credentials": {
"key": "[parameters('aiServicesKey')]"
},
"metadata": {
"ApiType": "Azure",
"ResourceId": "[parameters('aiServicesId')]"
Expand Down Expand Up @@ -897,6 +894,18 @@
"[resourceId('Microsoft.MachineLearningServices/workspaces', variables('aiHubName'))]"
]
},
{
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"name": "[guid(resourceId('Microsoft.MachineLearningServices/workspaces', variables('aiProjectName')), resourceId('Microsoft.Authorization/roleDefinitions', '64702f94-c441-49e6-a78b-ef80e0188fee'))]",
"properties": {
"roleDefinitionId": "[resourceId('Microsoft.Authorization/roleDefinitions', '64702f94-c441-49e6-a78b-ef80e0188fee')]",
"principalId": "[reference(resourceId('Microsoft.MachineLearningServices/workspaces', variables('aiProjectName')), '2024-01-01-preview', 'full').identity.principalId]"
},
"dependsOn": [
"[resourceId('Microsoft.MachineLearningServices/workspaces', variables('aiProjectName'))]"
]
},
{
"type": "Microsoft.KeyVault/vaults/secrets",
"apiVersion": "2021-11-01-preview",
Expand Down
Loading