Skip to content

Commit 0621f29

Browse files
authored
Merge pull request #225 from Evilazaro:refactor/deploymentNames
Refactor/deploymentNames
2 parents b327791 + b5719ce commit 0621f29

File tree

7 files changed

+29
-71
lines changed

7 files changed

+29
-71
lines changed

.configuration/devcenter/workloads/common-backend-config.dsc.yaml

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -235,55 +235,4 @@ properties:
235235
allowPrerelease: true
236236
description: Install Azure Storage Emulator for local development
237237
settings:
238-
id: Microsoft.Azure.StorageEmulator
239-
240-
# Resource: Azure Cosmos DB Emulator
241-
# Azure Cosmos DB Emulator provides a local instance of the Cosmos DB service
242-
# supporting multiple data models (SQL, MongoDB, Gremlin, etc.).
243-
#
244-
# Key Azure integration points:
245-
# - Support for SQL, MongoDB, Table, Gremlin, and Cassandra APIs
246-
# - Local development of multi-region applications
247-
# - Built-in data explorer for query development
248-
# - Export functionality for data migration
249-
# - Simulated consistency levels matching Azure Cosmos DB
250-
#
251-
# Development best practices:
252-
# - Use consistent connection logic between emulator and cloud
253-
# - Test with various consistency levels before deployment
254-
# - Simulate production request patterns for performance testing
255-
# - Create parameterized applications that work with both environments
256-
# - Ensure partition key strategies are validated locally
257-
# - Use environment-specific configuration for connection strings
258-
# - Implement retry logic that works in both environments
259-
# - Consider resource limits differences between emulator and cloud
260-
# - Validate performance with realistic data volumes
261-
#
262-
# Common development scenarios:
263-
# - NoSQL database application development
264-
# - Graph database implementations with Gremlin API
265-
# - High-performance, globally distributed application prototyping
266-
# - Schema evolution and migration testing
267-
# - Multi-model database application development
268-
#
269-
# Security note:
270-
# - The emulator uses a well-known certificate and key for development
271-
# - Never use the emulator's certificate in production environments
272-
# - Data persistence is local and requires backup consideration
273-
# - Consider implementing application-level encryption for sensitive data
274-
# - Be aware of differences in security features between emulator and cloud
275-
#
276-
# DSC-specific notes:
277-
# - Installation requires significant disk space (~2GB)
278-
# - May conflict with other applications using port 8081
279-
# - Consider configuring the emulator to start automatically
280-
# - Installation may require system restart
281-
#
282-
# Reference: https://learn.microsoft.com/en-us/azure/cosmos-db/local-emulator
283-
- resource: Microsoft.WinGet.DSC/WinGetPackage
284-
id: Microsoft.Azure.CosmosEmulator
285-
directives:
286-
allowPrerelease: true
287-
description: Install Azure Cosmos DB Emulator for local NoSQL database development
288-
settings:
289-
id: Microsoft.Azure.CosmosEmulator
238+
id: Microsoft.Azure.StorageEmulator

cleanSetUp.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[CmdletBinding()]
44
param(
55
[Parameter(Mandatory=$false)]
6-
[string]$EnvName = "demo",
6+
[string]$EnvName = "gitHub",
77

88
[Parameter(Mandatory=$false)]
99
[ValidateSet("eastus", "eastus2", "westus", "westus2", "northeurope", "westeurope")]

infra/main.bicep

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ output WORKLOAD_AZURE_RESOURCE_GROUP_NAME string = workloadRg.name
9696
// Module deployments with improved names and organization
9797
@description('Log Analytics Workspace for centralized monitoring')
9898
module monitoring '../src/management/logAnalytics.bicep' = {
99-
name: 'monitoring-logAnalytics-deployment-${environmentName}-${dateTime}'
99+
name: 'monitoring-logAnalytics-${environmentName}-${dateTime}'
100100
scope: resourceGroup(monitoringRgName)
101101
params: {
102102
name: 'logAnalytics'
@@ -114,7 +114,7 @@ output AZURE_LOG_ANALYTICS_WORKSPACE_NAME string = monitoring.outputs.AZURE_LOG_
114114

115115
@description('Security components including Key Vault')
116116
module security '../src/security/security.bicep' = {
117-
name: 'security-keyvault-deployment-${environmentName}-${dateTime}'
117+
name: 'security-keyvault-${environmentName}-${dateTime}'
118118
scope: resourceGroup(securityRgName)
119119
params: {
120120
secretValue: secretValue
@@ -137,7 +137,7 @@ output AZURE_KEY_VAULT_ENDPOINT string = security.outputs.AZURE_KEY_VAULT_ENDPOI
137137

138138
@description('DevCenter workload deployment')
139139
module workload '../src/workload/workload.bicep' = {
140-
name: 'workload-devcenter-deployment-${environmentName}-${dateTime}'
140+
name: 'workload-${environmentName}-${dateTime}'
141141
scope: resourceGroup(workloadRgName)
142142
params: {
143143
logAnalyticsId: monitoring.outputs.AZURE_LOG_ANALYTICS_WORKSPACE_ID

src/security/security.bicep

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ param logAnalyticsId string
1111
@description('Azure Key Vault Configuration')
1212
var securitySettings = loadYamlContent('../../infra/settings/security/security.yaml')
1313

14+
param dateTime string = utcNow('yyyyMMdd-HHmmss')
15+
1416
@description('Azure Key Vault')
1517
module keyVault 'keyVault.bicep' = if (securitySettings.create) {
18+
name: 'keyVault-${securitySettings.keyVault.name}-${dateTime}'
1619
params: {
1720
tags: tags
1821
keyvaultSettings: securitySettings
@@ -27,6 +30,7 @@ resource existingKeyVault 'Microsoft.KeyVault/vaults@2023-07-01' existing = if (
2730

2831
@description('Key vault secret module')
2932
module secret 'secret.bicep' = {
33+
name: 'keyVaultSecret-${securitySettings.keyVault.secretName}-${dateTime}'
3034
params: {
3135
name: securitySettings.keyVault.secretName
3236
keyVaultName: (securitySettings.create ? keyVault!.outputs.AZURE_KEY_VAULT_NAME : existingKeyVault!.name)

src/workload/core/devCenter.bicep

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ param secretIdentifier string
2222

2323
param securityResourceGroupName string
2424

25+
param dateTime string = utcNow('yyyyMMdd-HHmmss')
26+
2527
// Type definitions with proper naming conventions
2628
@description('DevCenter configuration type')
2729
type DevCenterConfig = {
@@ -122,7 +124,7 @@ resource diagnosticSettings 'Microsoft.Insights/diagnosticSettings@2021-05-01-pr
122124
@description('Dev Center Identity Role Assignments')
123125
module devCenterIdentityRoleAssignment '../../identity/devCenterRoleAssignment.bicep' = [
124126
for (role, i) in config.identity.roleAssignments.devCenter: {
125-
name: 'RBACDevCenterSub-${i}-${devCenterName}'
127+
name: 'RBACDevCenterSub-${i}-${devCenterName}-${dateTime}'
126128
scope: subscription()
127129
params: {
128130
id: role.id
@@ -135,7 +137,7 @@ module devCenterIdentityRoleAssignment '../../identity/devCenterRoleAssignment.b
135137
@description('Dev Center Identity Role Assignments')
136138
module devCenterIdentityRoleAssignmentRG '../../identity/devCenterRoleAssignmentRG.bicep' = [
137139
for (role, i) in config.identity.roleAssignments.devCenter: {
138-
name: 'RBACDevCenterRG-${i}-${devCenterName}'
140+
name: 'RBACDevCenterRG-${i}-${devCenterName}-${dateTime}'
139141
scope: resourceGroup(securityResourceGroupName)
140142
params: {
141143
id: role.id
@@ -151,7 +153,7 @@ module devCenterIdentityRoleAssignmentRG '../../identity/devCenterRoleAssignment
151153
@description('Dev Center Identity User Groups role assignments')
152154
module devCenterIdentityUserGroupsRoleAssignment '../../identity/orgRoleAssignment.bicep' = [
153155
for (role, i) in config.identity.roleAssignments.orgRoleTypes: {
154-
name: 'RBACUserGroup-${i}-${devCenterName}'
156+
name: 'RBACUserGroup-${i}-${devCenterName}-${dateTime}'
155157
scope: resourceGroup()
156158
params: {
157159
principalId: role.azureADGroupId
@@ -167,7 +169,7 @@ module devCenterIdentityUserGroupsRoleAssignment '../../identity/orgRoleAssignme
167169
@description('Dev Center Catalogs')
168170
module catalog 'catalog.bicep' = [
169171
for (catalog, i) in catalogs: {
170-
name: 'catalog-${i}-${devCenterName}'
172+
name: 'catalog-${i}-${devCenterName}-${dateTime}'
171173
scope: resourceGroup()
172174
params: {
173175
devCenterName: devCenterName
@@ -185,12 +187,11 @@ module catalog 'catalog.bicep' = [
185187
@description('Dev Center Environments')
186188
module environment 'environmentType.bicep' = [
187189
for (environment, i) in environmentTypes: {
188-
name: 'environmentType-${i}-${devCenterName}'
190+
name: 'environmentType-${i}-${devCenterName}-${dateTime}'
189191
scope: resourceGroup()
190192
params: {
191193
devCenterName: devCenterName
192194
environmentConfig: environment
193195
}
194196
}
195197
]
196-

src/workload/project/project.bicep

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ param identity Identity
3636
@description('Tags to be applied to all resources')
3737
param tags object = {}
3838

39+
param dateTime string = utcNow('yyyyMMdd-HHmmss')
40+
3941
@description('Identity configuration for the project')
4042
type Identity = {
4143
@description('Type of managed identity (SystemAssigned or UserAssigned)')
@@ -98,7 +100,7 @@ resource project 'Microsoft.DevCenter/projects@2025-04-01-preview' = {
98100
@description('Configure project identity role assignments')
99101
module projectIdentity '../../identity/projectIdentityRoleAssignment.bicep' = [
100102
for (role, i) in identity.roleAssignments: {
101-
name: 'prj-rbac${i}-${uniqueString(project.id, project.name)}'
103+
name: 'prj-rbac${i}-${uniqueString(project.id, project.name)}-${dateTime}'
102104
scope: resourceGroup()
103105
params: {
104106
projectName: project.name
@@ -112,7 +114,7 @@ module projectIdentity '../../identity/projectIdentityRoleAssignment.bicep' = [
112114
@description('Configure project identity role assignments')
113115
module projectIdentityRG '../../identity/projectIdentityRoleAssignmentRG.bicep' = [
114116
for (role, i) in identity.roleAssignments: {
115-
name: 'prj-rbac-RG-${i}-${uniqueString(project.id, project.name)}'
117+
name: 'prj-rbac-RG-${i}-${uniqueString(project.id, project.name)}-${dateTime}'
116118
scope: resourceGroup(securityResourceGroupName)
117119
params: {
118120
projectName: project.name
@@ -126,7 +128,7 @@ module projectIdentityRG '../../identity/projectIdentityRoleAssignmentRG.bicep'
126128
@description('Add the AD Group to the DevCenter project')
127129
module projectADGroup '../../identity/projectIdentityRoleAssignment.bicep' = [
128130
for (role, i) in identity.roleAssignments: {
129-
name: 'prj-adgroup-${i}-${uniqueString(project.id, project.name)}'
131+
name: 'prj-adgroup-${i}-${uniqueString(project.id, project.name)}-${dateTime}'
130132
scope: resourceGroup()
131133
params: {
132134
projectName: project.name
@@ -139,7 +141,7 @@ module projectADGroup '../../identity/projectIdentityRoleAssignment.bicep' = [
139141

140142
@description('Configure environment definition catalogs')
141143
module catalogs 'projectCatalog.bicep' = {
142-
name: 'catalog-${uniqueString(project.id)}'
144+
name: 'catalog-${uniqueString(project.id)}-${dateTime}'
143145
scope: resourceGroup()
144146
params: {
145147
projectName: project.name
@@ -156,7 +158,7 @@ module catalogs 'projectCatalog.bicep' = {
156158
@description('Configure project environment types')
157159
module environmentTypes 'projectEnvironmentType.bicep' = [
158160
for (envType, i) in projectEnvironmentTypes: {
159-
name: 'env-type-${i}-${uniqueString(project.id, envType.name)}'
161+
name: 'env-type-${i}-${uniqueString(project.id, envType.name)}-${dateTime}'
160162
scope: resourceGroup()
161163
params: {
162164
projectName: project.name
@@ -173,7 +175,7 @@ module environmentTypes 'projectEnvironmentType.bicep' = [
173175

174176
@description('Connectivity configuration for the project')
175177
module connectivity '../../connectivity/connectivity.bicep' = {
176-
name: 'connectivity-${uniqueString(project.id)}'
178+
name: 'connectivity-${uniqueString(project.id)}-${dateTime}'
177179
scope: resourceGroup()
178180
params: {
179181
devCenterName: devCenterName
@@ -192,7 +194,7 @@ module connectivity '../../connectivity/connectivity.bicep' = {
192194
@description('Configure DevBox pools for the project')
193195
module pools 'projectPool.bicep' = [
194196
for (pool, i) in projectPools: {
195-
name: 'pool-${i}-${uniqueString(project.id, pool.name)}'
197+
name: 'pool-${i}-${uniqueString(project.id, pool.name)}-${dateTime}'
196198
scope: resourceGroup()
197199
params: {
198200
name: pool.name

src/workload/workload.bicep

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ param secretIdentifier string
1717
@minLength(3)
1818
param securityResourceGroupName string
1919

20+
param dateTime string = utcNow('yyyyMMdd-HHmmss')
21+
2022
// Resource types with documentation
2123
@description('Landing Zone configuration type')
2224
type LandingZone = {
@@ -32,7 +34,7 @@ var devCenterSettings = loadYamlContent('../../infra/settings/workload/devcenter
3234
// Deploy core DevCenter infrastructure
3335
@description('DevCenter Core Infrastructure')
3436
module devcenter 'core/devCenter.bicep' = {
35-
name: 'devCenterDeployment'
37+
name: 'devCenter-${dateTime}'
3638
scope: resourceGroup()
3739
params: {
3840
config: devCenterSettings
@@ -51,7 +53,7 @@ output AZURE_DEV_CENTER_NAME string = devcenter.outputs.AZURE_DEV_CENTER_NAME
5153
@description('DevCenter Projects')
5254
module projects 'project/project.bicep' = [
5355
for (project, i) in devCenterSettings.projects: {
54-
name: 'project-${project.name}'
56+
name: 'project-${project.name}-${dateTime}'
5557
scope: resourceGroup()
5658
params: {
5759
name: project.name

0 commit comments

Comments
 (0)