Skip to content

Commit feff606

Browse files
committed
chore: fix role assignments
1 parent 52025d3 commit feff606

2 files changed

Lines changed: 9 additions & 17 deletions

File tree

infra/app/llama-index-nextjs.bicep

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ resource identity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31'
3333
location: location
3434
}
3535

36-
resource containerRegistry 'Microsoft.ContainerRegistry/registries@2023-01-01-preview' existing = {
37-
name: containerRegistryName
38-
}
39-
4036
resource containerAppsEnvironment 'Microsoft.App/managedEnvironments@2023-05-01' existing = {
4137
name: containerAppsEnvironmentName
4238
}
@@ -45,22 +41,10 @@ resource applicationInsights 'Microsoft.Insights/components@2020-02-02' existing
4541
name: applicationInsightsName
4642
}
4743

48-
resource acrPullRole 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
49-
scope: containerRegistry
50-
name: guid(subscription().id, resourceGroup().id, identity.id, 'acrPullRole')
51-
properties: {
52-
principalId: identity.properties.principalId
53-
roleDefinitionId: '7f951dda-4ed3-4680-a7ca-43fe172d538d'
54-
principalType: 'ServicePrincipal'
55-
}
56-
}
57-
58-
5944
// Roles
6045

6146
// User roles
6247
module openAiRoleUser '../shared/role.bicep' = if (empty(runningOnGh)) {
63-
scope: resourceGroup()
6448
name: guid(subscription().id, resourceGroup().id, identity.id, 'openaiUserRole')
6549
params: {
6650
principalId: principalId
@@ -72,7 +56,6 @@ module openAiRoleUser '../shared/role.bicep' = if (empty(runningOnGh)) {
7256

7357
// System roles
7458
module openAiRoleBackend '../shared/role.bicep' = {
75-
scope: resourceGroup()
7659
name: guid(subscription().id, resourceGroup().id, identity.id, 'openaiServicePrincipalRole')
7760
params: {
7861
principalId: app.identity.principalId
@@ -81,6 +64,14 @@ module openAiRoleBackend '../shared/role.bicep' = {
8164
principalType: 'ServicePrincipal'
8265
}
8366
}
67+
module acrPullRole '../shared/role.bicep' = {
68+
name: guid(subscription().id, resourceGroup().id, identity.id, 'acrPullRole')
69+
params: {
70+
principalId: identity.properties.principalId
71+
roleDefinitionId: '7f951dda-4ed3-4680-a7ca-43fe172d538d'
72+
principalType: 'ServicePrincipal'
73+
}
74+
}
8475

8576
module fetchLatestImage '../modules/fetch-container-image.bicep' = {
8677
name: '${name}-fetch-image'

infra/main.bicep

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ module llamaIndexNextjs './app/llama-index-nextjs.bicep' = {
169169
containerAppsEnvironmentName: appsEnv.outputs.name
170170
containerRegistryName: registry.outputs.name
171171
exists: llamaIndexNextjsExists
172+
principalId: principalId
172173
appDefinition: union(llamaIndexNextjsDefinition, {
173174
settings: [
174175
{

0 commit comments

Comments
 (0)