Skip to content

Commit

Permalink
Updates deployment names and role assignments
Browse files Browse the repository at this point in the history
  • Loading branch information
wbreza committed Oct 16, 2023
1 parent c0a6c1b commit 8db216d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions infra/core/devcenter/devcenter.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ resource devcenter 'Microsoft.DevCenter/devcenters@2023-04-01' = {
}

module devCenterEnvType 'devcenter-environment-type.bicep' = [for envType in config.environmentTypes: {
name: '${devcenter.name}-environment-type-${envType.name}'
name: '${deployment().name}-${envType.name}'
params: {
name: envType.name
tags: empty(envType.tags) ? {} : envType.tags
Expand All @@ -73,7 +73,7 @@ module devCenterEnvType 'devcenter-environment-type.bicep' = [for envType in con
}]

module devCenterProject 'project.bicep' = [for project in config.projects: {
name: '${devcenter.name}-project-${project.name}'
name: '${deployment().name}-${project.name}'
params: {
name: project.name
location: location
Expand All @@ -86,15 +86,15 @@ module devCenterProject 'project.bicep' = [for project in config.projects: {
}]

module devCenterKeyVaultAccess '../security/keyvault-access.bicep' = {
name: '${devcenter.name}-keyvault-access'
name: '${deployment().name}-keyvault-access'
params: {
keyVaultName: keyVaultName
principalId: devcenter.identity.principalId
}
}

module catalogPatToken '../security/keyvault-secret.bicep' = {
name: '${devcenter.name}-catalog-token'
name: '${deployment().name}-catalog-token'
params: {
name: '${devcenter.name}-catalog-token'
keyVaultName: keyVaultName
Expand All @@ -103,7 +103,7 @@ module catalogPatToken '../security/keyvault-secret.bicep' = {
}

module devCenterCatalog 'catalog.bicep' = [for catalog in config.catalogs: {
name: '${devcenter.name}-catalog-${catalog.name}'
name: '${deployment().name}-${catalog.name}'
params: {
devCenterName: devcenter.name
name: catalog.name
Expand Down
2 changes: 1 addition & 1 deletion infra/core/devcenter/project-access.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ resource project 'Microsoft.DevCenter/projects@2023-04-01' existing = {
}

resource roleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(project.name, principalRole, principalId)
name: guid(project.id, principalRole, principalId)
scope: project
properties: {
principalId: principalId
Expand Down
2 changes: 1 addition & 1 deletion infra/core/devcenter/project-environment-type-access.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ resource environmentType 'Microsoft.DevCenter/projects/environmentTypes@2023-04-
}

resource roleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(project.name, environmentType.name, deploymentEnvironmentsUser, principalId)
name: guid(environmentType.id, deploymentEnvironmentsUser, principalId)
scope: environmentType
properties: {
principalId: principalId
Expand Down
10 changes: 5 additions & 5 deletions infra/core/devcenter/project-environment-type.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ var ownerRole = subscriptionResourceId('Microsoft.Authorization/roleDefinitions'

// The devcenter principal requires owner access on the target subscription
module devCenterSubscriptionAccess 'subscription-access.bicep' = {
name: '${devCenter.name}-subscription-access'
name: '${deployment().name}-devcenter-subscription-access'
scope: subscription(subscriptionId)
params: {
name: guid(subscriptionId, devCenter.name, ownerRole, devCenter.identity.principalId)
name: guid(devCenter.id, ownerRole, devCenter.identity.principalId)
principalId: devCenter.identity.principalId
roleDefinitionId: ownerRole
principalType: 'ServicePrincipal'
Expand All @@ -77,18 +77,18 @@ module devCenterSubscriptionAccess 'subscription-access.bicep' = {

// The environment type principal requires owner access on the target subscription
module environmentTypeSubscriptionAccess 'subscription-access.bicep' = {
name: 'subscription-access-${project.name}-${environmentType.name}'
name: '${deployment().name}-subscription-access'
scope: subscription(subscriptionId)
params: {
name: guid(subscriptionId, projectName, environmentType.name, ownerRole, environmentType.identity.principalId)
name: guid(environmentType.id, ownerRole, environmentType.identity.principalId)
principalId: environmentType.identity.principalId
roleDefinitionId: ownerRole
principalType: 'ServicePrincipal'
}
}

module memberAccess 'project-environment-type-access.bicep' = [for member in members: {
name: '${project.name}-member-${member}'
name: '${deployment().name}-member-access-${uniqueString(project.name, environmentType.name, member)}'
params: {
projectName: project.name
environmentTypeName: environmentType.name
Expand Down
6 changes: 3 additions & 3 deletions infra/core/devcenter/project.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ resource project 'Microsoft.DevCenter/projects@2023-04-01' = {
}

module projectEnvType 'project-environment-type.bicep' = [for envType in environmentTypes: {
name: '${project.name}-environment-type-${envType.name}'
name: '${deployment().name}-${envType.name}'
params: {
devCenterName: devCenterName
projectName: project.name
Expand All @@ -58,7 +58,7 @@ var deploymentEnvironmentsUser = subscriptionResourceId('Microsoft.Authorization
var projectAdmin = subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '331c37c6-af14-46d9-b9f4-e1909e1b95a0')

module memberAccess 'project-access.bicep' = [for member in members: {
name: '${project.name}-member-${member}'
name: '${deployment().name}-member-access-${uniqueString(project.name, member)}'
params: {
projectName: project.name
principalId: member
Expand All @@ -67,7 +67,7 @@ module memberAccess 'project-access.bicep' = [for member in members: {
}]

module projectAdminAccess 'project-access.bicep' = if (!empty(projectAdminId)) {
name: '${project.name}-admin-${projectAdminId}'
name: '${deployment().name}-admin-access-${uniqueString(project.name, projectAdminId)}'
params: {
projectName: project.name
principalId: projectAdminId
Expand Down

0 comments on commit 8db216d

Please sign in to comment.