Skip to content

Commit dc23cba

Browse files
Merge pull request #206 from microsoft/feature/dev-localauthchanges
fix: fix for disablelocalauth issue
2 parents 44f562e + 9eee75a commit dc23cba

File tree

3 files changed

+33
-14
lines changed

3 files changed

+33
-14
lines changed

infra/deploy_ai_foundry.bicep

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ param gptModelName string
66
param gptModelVersion string
77
param managedIdentityObjectId string
88
param aiServicesEndpoint string
9-
param aiServices object
9+
param aiServicesKey string
1010
param aiServicesId string
1111

1212
var storageName = '${solutionName}hubstorage'
@@ -133,11 +133,8 @@ resource aiHub 'Microsoft.MachineLearningServices/workspaces@2023-08-01-preview'
133133
properties: {
134134
category: 'AIServices'
135135
target: aiServicesEndpoint
136-
authType: 'ApiKey'
136+
authType: 'AAD'
137137
isSharedToAll: true
138-
credentials: {
139-
key: aiServices.Key.key1
140-
}
141138
metadata: {
142139
ApiType: 'Azure'
143140
ResourceId: aiServicesId
@@ -159,6 +156,19 @@ resource aiHubProject 'Microsoft.MachineLearningServices/workspaces@2024-01-01-p
159156
}
160157
}
161158

159+
resource aiDeveloper 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = {
160+
name: '64702f94-c441-49e6-a78b-ef80e0188fee'
161+
}
162+
163+
resource aiDevelopertoAIProject 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
164+
name: guid(aiHubProject.id, aiDeveloper.id)
165+
scope: resourceGroup()
166+
properties: {
167+
roleDefinitionId: aiDeveloper.id
168+
principalId: aiHubProject.identity.principalId
169+
}
170+
}
171+
162172
resource tenantIdEntry 'Microsoft.KeyVault/vaults/secrets@2021-11-01-preview' = {
163173
parent: keyVault
164174
name: 'TENANT-ID'
@@ -187,7 +197,7 @@ resource azureOpenAIApiKeyEntry 'Microsoft.KeyVault/vaults/secrets@2021-11-01-pr
187197
parent: keyVault
188198
name: 'AZURE-OPENAI-KEY'
189199
properties: {
190-
value: aiServices.Key.key1 //aiServices_m.listKeys().key1
200+
value: aiServicesKey //aiServices_m.listKeys().key1
191201
}
192202
}
193203

@@ -251,7 +261,7 @@ resource cogServiceKeyEntry 'Microsoft.KeyVault/vaults/secrets@2021-11-01-previe
251261
parent: keyVault
252262
name: 'COG-SERVICES-KEY'
253263
properties: {
254-
value: aiServices.Key.key1
264+
value: aiServicesKey
255265
}
256266
}
257267

infra/main.bicep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ module aifoundry 'deploy_ai_foundry.bicep' = {
168168
gptModelVersion: gptModelVersion
169169
managedIdentityObjectId: managedIdentityModule.outputs.managedIdentityOutput.objectId
170170
aiServicesEndpoint: aiServices.properties.endpoint
171-
aiServices: aiServices
171+
aiServicesKey: aiServices.listKeys().key1
172172
aiServicesId: aiServices.id
173173
}
174174
scope: resourceGroup(resourceGroup().name)

infra/main.json

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"_generator": {
77
"name": "bicep",
88
"version": "0.35.1.17967",
9-
"templateHash": "18228555099764132241"
9+
"templateHash": "4778084734742710121"
1010
}
1111
},
1212
"parameters": {
@@ -712,7 +712,7 @@
712712
"_generator": {
713713
"name": "bicep",
714714
"version": "0.35.1.17967",
715-
"templateHash": "9490638595753234802"
715+
"templateHash": "14561153070486462167"
716716
}
717717
},
718718
"parameters": {
@@ -767,11 +767,8 @@
767767
"properties": {
768768
"category": "AIServices",
769769
"target": "[parameters('aiServicesEndpoint')]",
770-
"authType": "ApiKey",
770+
"authType": "AAD",
771771
"isSharedToAll": true,
772-
"credentials": {
773-
"key": "[parameters('aiServicesKey')]"
774-
},
775772
"metadata": {
776773
"ApiType": "Azure",
777774
"ResourceId": "[parameters('aiServicesId')]"
@@ -897,6 +894,18 @@
897894
"[resourceId('Microsoft.MachineLearningServices/workspaces', variables('aiHubName'))]"
898895
]
899896
},
897+
{
898+
"type": "Microsoft.Authorization/roleAssignments",
899+
"apiVersion": "2022-04-01",
900+
"name": "[guid(resourceId('Microsoft.MachineLearningServices/workspaces', variables('aiProjectName')), resourceId('Microsoft.Authorization/roleDefinitions', '64702f94-c441-49e6-a78b-ef80e0188fee'))]",
901+
"properties": {
902+
"roleDefinitionId": "[resourceId('Microsoft.Authorization/roleDefinitions', '64702f94-c441-49e6-a78b-ef80e0188fee')]",
903+
"principalId": "[reference(resourceId('Microsoft.MachineLearningServices/workspaces', variables('aiProjectName')), '2024-01-01-preview', 'full').identity.principalId]"
904+
},
905+
"dependsOn": [
906+
"[resourceId('Microsoft.MachineLearningServices/workspaces', variables('aiProjectName'))]"
907+
]
908+
},
900909
{
901910
"type": "Microsoft.KeyVault/vaults/secrets",
902911
"apiVersion": "2021-11-01-preview",

0 commit comments

Comments
 (0)