Skip to content

Commit 5009774

Browse files
fix: Role assignment issue for running post deployment script (#102)
1 parent a765454 commit 5009774

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

infra/modules/cognitive-services/cognitiveServices.bicep

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ var allRoleAssignments = concat(empty(userObjectId) ? [] : [
110110
principalType: deployerPrincipalType
111111
roleDefinitionIdOrName: 'Cognitive Services User'
112112
}
113+
{
114+
principalId: userObjectId
115+
principalType: deployerPrincipalType
116+
roleDefinitionIdOrName: '53ca6127-db72-4b80-b1b0-d745d6d5456d'
117+
}
113118
], roleAssignmentsForServicePrincipals)
114119

115120
module aiServices 'service.bicep' = {

infra/modules/vmscriptsetup.bicep

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ var searchServiceContributorRoleId = subscriptionResourceId(
6565
'7ca78c08-252a-4471-8644-bb5ff32d4ba0'
6666
)
6767

68+
var azureAIUserRoleId = subscriptionResourceId(
69+
'Microsoft.Authorization/roleDefinitions',
70+
'53ca6127-db72-4b80-b1b0-d745d6d5456d'
71+
)
72+
6873
resource searchIndexRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = if(networkIsolation) {
6974
name: guid(aiSearchResource.id, virtualMachinePrincipalId, 'SearchIndexDataContributor')
7075
scope: aiSearchResource
@@ -86,14 +91,14 @@ resource searchServiceRoleAssignment 'Microsoft.Authorization/roleAssignments@20
8691
}
8792

8893
@description('Role definition ID or name')
89-
var openAiUserRole = 'Cognitive Services OpenAI User'
94+
var aiUserRole = 'Azure AI User'
9095

9196
resource roleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = if(networkIsolation) {
92-
name: guid(cognitiveServicesRes.id, virtualMachinePrincipalId, openAiUserRole)
97+
name: guid(cognitiveServicesRes.id, virtualMachinePrincipalId, aiUserRole)
9398
scope: cognitiveServicesRes
9499
properties: {
95100
principalId: virtualMachinePrincipalId
96-
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '5e0bd9bd-7b93-4f28-af87-19fc36ad61bd') // OpenAI User Role
101+
roleDefinitionId: azureAIUserRoleId
97102
principalType: 'ServicePrincipal'
98103
}
99104
}

0 commit comments

Comments
 (0)