Skip to content

Commit b327791

Browse files
authored
Merge pull request #224 from Evilazaro:fix/ConnectivityRG
Fix/ConnectivityRG
2 parents 30dd7df + 98d62af commit b327791

File tree

4 files changed

+41
-27
lines changed

4 files changed

+41
-27
lines changed

infra/main.bicep

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ param secretValue string
3131
@maxLength(10)
3232
param environmentName string
3333

34+
param dateTime string = utcNow('yyyyMMdd-HHmmss')
35+
3436
// Load configuration from YAML
3537
@description('Landing Zone resource organization')
3638
var landingZones = loadYamlContent('settings/resourceOrganization/azureResources.yaml')
@@ -94,7 +96,7 @@ output WORKLOAD_AZURE_RESOURCE_GROUP_NAME string = workloadRg.name
9496
// Module deployments with improved names and organization
9597
@description('Log Analytics Workspace for centralized monitoring')
9698
module monitoring '../src/management/logAnalytics.bicep' = {
97-
name: 'monitoring-logAnalytics-deployment-${environmentName}'
99+
name: 'monitoring-logAnalytics-deployment-${environmentName}-${dateTime}'
98100
scope: resourceGroup(monitoringRgName)
99101
params: {
100102
name: 'logAnalytics'
@@ -112,7 +114,7 @@ output AZURE_LOG_ANALYTICS_WORKSPACE_NAME string = monitoring.outputs.AZURE_LOG_
112114

113115
@description('Security components including Key Vault')
114116
module security '../src/security/security.bicep' = {
115-
name: 'security-keyvault-deployment-${environmentName}'
117+
name: 'security-keyvault-deployment-${environmentName}-${dateTime}'
116118
scope: resourceGroup(securityRgName)
117119
params: {
118120
secretValue: secretValue
@@ -135,7 +137,7 @@ output AZURE_KEY_VAULT_ENDPOINT string = security.outputs.AZURE_KEY_VAULT_ENDPOI
135137

136138
@description('DevCenter workload deployment')
137139
module workload '../src/workload/workload.bicep' = {
138-
name: 'workload-devcenter-deployment-${environmentName}'
140+
name: 'workload-devcenter-deployment-${environmentName}-${dateTime}'
139141
scope: resourceGroup(workloadRgName)
140142
params: {
141143
logAnalyticsId: monitoring.outputs.AZURE_LOG_ANALYTICS_WORKSPACE_ID

infra/settings/workload/devcenter.yaml

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,13 @@ identity:
2424

2525
# Role assignments section - defines permissions for Dev Center operation
2626
roleAssignments:
27+
# Dev Center role assignments
28+
# These roles control who can manage the Dev Center and its projects
29+
# Best practice: Assign roles based on team responsibilities
30+
# The following roles follow the principle of least privilege and best practices described in https://learn.microsoft.com/en-us/azure/dev-box/concept-dev-box-deployment-guide#organizational-roles-and-responsibilities guidance.
2731
devCenter:
2832
- id: "b24988ac-6180-42a0-ab88-20f7382dd24c"
29-
name: "Contributor"
33+
name: "Contributor" # Azure Contributor role for Dev Center management
3034
scope: "Subscription"
3135
- id: "18d7d88d-d35e-4fb5-a5c3-7773c20a72d9"
3236
name: "User Access Administrator"
@@ -42,7 +46,7 @@ identity:
4246
# Dev Manager role - for users who manage Dev Box deployments
4347
# These users can configure Dev Box definitions but typically don't use Dev Boxes
4448
- type: DevManager
45-
azureADGroupId: "5a1d1455-e771-4c19-aa03-fb4a08418f22"
49+
azureADGroupId: "5a1d1455-e771-4c19-aa03-fb4a08418f22" # Azure AD group ID for Dev Managers. You must create this group in Azure AD and replace the <Azure AD group ID>, the default value in this example is "Platform Engineering Team"
4650
azureADGroupName: "Platform Engineering Team"
4751

4852
# RBAC roles assigned to Dev Managers
@@ -67,31 +71,31 @@ catalogs:
6771
# Best practice: Create environments that match your SDLC stages (dev, test, prod)
6872
environmentTypes:
6973
- name: "dev"
70-
deploymentTargetId: "" # Empty for default subscription target
74+
deploymentTargetId: "" # Empty for default subscription target. If you want to deploy to a specific target, provide the target ID here.
7175
- name: "staging"
72-
deploymentTargetId: "" # Empty for default subscription target
76+
deploymentTargetId: "" # Empty for default subscription target. If you want to deploy to a specific target, provide the target ID here.
7377
- name: "UAT"
74-
deploymentTargetId: "" # Empty for default subscription target
78+
deploymentTargetId: "" # Empty for default subscription target. If you want to deploy to a specific target, provide the target ID here.
7579

7680
# Projects section - defines distinct projects within the Dev Center
7781
# Each project has its own Dev Box configurations, catalogs, and permissions
7882
# Best practice: Create separate projects for different teams or workstreams
7983
projects:
8084
# Identity Provider project - for authentication/authorization services
81-
- name: "identityProvider"
82-
description: "Identity Provider project."
85+
- name: "identityProvider" # Name of the project
86+
description: "Identity Provider project." # Project description
8387

8488
network:
85-
name: identityProvider
86-
create: true
87-
resourceGroupName: "identityProvider-connectivity-RG"
88-
virtualNetworkType: Managed
89-
addressPrefixes:
89+
name: identityProvider # Name of the virtual network
90+
create: true # Set this parameter to true to create the network. If its value is false, the the accelerator will connect to an existing network.
91+
resourceGroupName: "identityProvider-connectivity-RG" # Resource group for network. If the create parameter is set to false, the resource group must already exist.
92+
virtualNetworkType: Managed # Managed network type is recommended for Dev Center projects to ensure proper connectivity and security
93+
addressPrefixes: # Address space for the virtual network. This should be a unique CIDR block that does not overlap with other networks in your Azure subscription. If the create parameter is set to true, the accelerator will create the network with this address space.
9094
- 10.0.0.0/16
9195
subnets:
92-
- name: identityProvider-subnet
96+
- name: identityProvider-subnet # Subnet name. If the create parameter is set to true, the accelerator will create the subnet with this name and address prefix. If its value is false, the subnet must already exist.
9397
properties:
94-
addressPrefix: 10.0.1.0/24
98+
addressPrefix: 10.0.1.0/24 # Subnet address range. If the create parameter is set to true, the accelerator will create the subnet with this address range. If its value is false, the subnet must already exist.
9599
tags:
96100
environment: dev
97101
division: Platforms
@@ -104,9 +108,15 @@ projects:
104108
# Project identity configuration - controls project-level security
105109
identity:
106110
type: SystemAssigned
111+
# Role assignments for the Project
112+
# These roles control who can manage the project and its resources
113+
# You must create the corresponding Azure AD groups and assign users to them
114+
# The default values in this example are "Identity Provider Engineers"
115+
# You can customize these values based on your organization's requirements
116+
# The following roles follow the principle of least privilege and best practices described in https://learn.microsoft.com/en-us/azure/dev-box/concept-dev-box-deployment-guide#organizational-roles-and-responsibilities guidance.
107117
roleAssignments:
108-
- azureADGroupId: "67a29bc3-f25c-4599-9cb1-4da19507e8ee"
109-
azureADGroupName: "Identity Provider Engineers"
118+
- azureADGroupId: "67a29bc3-f25c-4599-9cb1-4da19507e8ee" # Azure AD group ID for Identity Provider Engineers. You must create this group in Azure AD and replace the <Azure AD group ID>, the default value in this example is "Identity Provider Engineers"
119+
azureADGroupName: "Identity Provider Engineers" # Azure AD group name
110120
azureRBACRoles:
111121
- name: "Contributor"
112122
id: "b24988ac-6180-42a0-ab88-20f7382dd24c"

src/connectivity/connectivity.bicep

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ param logAnalyticsId string
1010
@description('Azure region for resource deployment')
1111
param location string
1212

13-
var rgCreate = (projectNetwork.create && projectNetwork.virtualNetworkType == 'Unmanaged')
13+
param dateTime string = utcNow('yyyy-MM-ddTHH:mm:ssZ')
14+
15+
var netConectCreate = (projectNetwork.create && projectNetwork.virtualNetworkType == 'Unmanaged') || (!projectNetwork.create && projectNetwork.virtualNetworkType == 'Unmanaged')
1416

1517
module Rg 'resourceGroup.bicep' = {
1618
name: 'projectNetworkRg-${uniqueString(projectNetwork.name, location)}'
@@ -19,13 +21,15 @@ module Rg 'resourceGroup.bicep' = {
1921
name: projectNetwork.resourceGroupName
2022
location: location
2123
tags: projectNetwork.tags
22-
create: rgCreate
24+
create: netConectCreate
2325
}
2426
}
2527

28+
var rgName = (netConectCreate) ? projectNetwork.resourceGroupName : resourceGroup().name
29+
2630
module virtualNetwork 'vnet.bicep' = {
27-
name: 'virtualNetwork-${uniqueString(projectNetwork.name, location)}'
28-
scope: resourceGroup(projectNetwork.resourceGroupName)
31+
name: 'virtualNetwork-${uniqueString(projectNetwork.name, resourceGroup().id, dateTime)}'
32+
scope: resourceGroup(rgName)
2933
params: {
3034
logAnalyticsId: logAnalyticsId
3135
location: location
@@ -44,11 +48,9 @@ module virtualNetwork 'vnet.bicep' = {
4448
]
4549
}
4650

47-
var netConectCreate = (projectNetwork.create && projectNetwork.virtualNetworkType == 'Unmanaged') || (!projectNetwork.create && projectNetwork.virtualNetworkType == 'Unmanaged')
48-
4951
@description('Network Connection resource for DevCenter')
5052
module networkConnection './networkConnection.bicep' = if (netConectCreate) {
51-
name: 'netconn-${uniqueString(projectNetwork.name,resourceGroup().id)}'
53+
name: 'netconn-${uniqueString(projectNetwork.name,resourceGroup().id,dateTime)}'
5254
scope: resourceGroup()
5355
params: {
5456
devCenterName: devCenterName

src/connectivity/vnet.bicep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ resource virtualNetwork 'Microsoft.Network/virtualNetworks@2024-07-01' = if (set
5757
@description('Reference to existing Virtual Network')
5858
resource existingVirtualNetwork 'Microsoft.Network/virtualNetworks@2024-07-01' existing = if (!settings.create && settings.virtualNetworkType == 'Unmanaged') {
5959
name: settings.name
60-
scope: resourceGroup()
60+
scope: resourceGroup(settings.resourceGroupName)
6161
}
6262

6363
@description('Log Analytics Diagnostic Settings')

0 commit comments

Comments
 (0)