Skip to content

Commit

Permalink
More naming updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jamasten committed Feb 9, 2024
1 parent 46c6f34 commit 33bdceb
Show file tree
Hide file tree
Showing 13 changed files with 221 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ param resourceGroupManagement string
param resourceGroupStorage string
param securityPrincipalObjectIds array
param securityPrincipalNames array
param serviceName string
@minLength(3)
param storageAccountNamePrefix string
param storageAccountNetworkInterfaceNamePrefix string
param storageAccountPrivateEndpointNamePrefix string
param storageCount int
param storageEncryptionKeyName string
param storageIndex int
Expand Down Expand Up @@ -166,14 +169,14 @@ module shares 'shares.bicep' = [for i in range(0, storageCount): {
}]

resource privateEndpoints 'Microsoft.Network/privateEndpoints@2023-04-01' = [for i in range(0, storageCount): {
name: 'pe-${storageAccountNamePrefix}${padLeft(i + storageIndex, 2, '0')}-file'
name: '${replace(storageAccountPrivateEndpointNamePrefix, serviceName, 'file')}${padLeft(i + storageIndex, 2, '0')}'
location: location
tags: tagsPrivateEndpoints
properties: {
customNetworkInterfaceName: 'nic-${storageAccountNamePrefix}${padLeft(i + storageIndex, 2, '0')}-file'
customNetworkInterfaceName: '${replace(storageAccountNetworkInterfaceNamePrefix, serviceName, 'file')}${padLeft(i + storageIndex, 2, '0')}'
privateLinkServiceConnections: [
{
name: 'pe-${storageAccounts[i].name}'
name: '${replace(storageAccountPrivateEndpointNamePrefix, serviceName, 'file')}${padLeft(i + storageIndex, 2, '0')}'
properties: {
privateLinkServiceId: storageAccounts[i].id
groupIds: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ param resourceGroupManagement string
param resourceGroupStorage string
param securityPrincipalObjectIds array
param securityPrincipalNames array
param serviceName string
param smbServerLocation string
param storageAccountNamePrefix string
param storageAccountNetworkInterfaceNamePrefix string
param storageAccountPrivateEndpointNamePrefix string
param storageCount int
param storageEncryptionKeyName string
param storageIndex int
Expand Down Expand Up @@ -116,7 +119,10 @@ module azureFiles 'azureFiles/azureFiles.bicep' = if (storageService == 'AzureFi
resourceGroupStorage: resourceGroupStorage
securityPrincipalNames: securityPrincipalNames
securityPrincipalObjectIds: securityPrincipalObjectIds
serviceName: serviceName
storageAccountNamePrefix: storageAccountNamePrefix
storageAccountNetworkInterfaceNamePrefix: storageAccountNetworkInterfaceNamePrefix
storageAccountPrivateEndpointNamePrefix: storageAccountPrivateEndpointNamePrefix
storageCount: storageCount
storageEncryptionKeyName: storageEncryptionKeyName
storageIndex: storageIndex
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
param location string
param resourceGroupManagement string
param serviceName string
param storageAccountName string
param subscriptionId string
param tags object
param timestamp string
param userAssignedIdentityNamePrefix string

var name = '${userAssignedIdentityNamePrefix}-artifacts'
var name = replace(userAssignedIdentityNamePrefix, serviceName, 'artifacts')
var roleDefinitionId = '2a2b9908-6ea1-4ae2-8e65-a410df84e7d1' // Storage Blob Data Reader

resource storageAccount 'Microsoft.Storage/storageAccounts@2023-01-01' existing = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ param keyVaultNetworkInterfaceName string
param keyVaultPrivateEndpointName string
param keyVaultPrivateDnsZoneResourceId string
param location string
param serviceName string
param subnetResourceId string
param tags object
param timestamp string
Expand Down Expand Up @@ -149,7 +150,7 @@ module userAssignedIdentity 'userAssignedIdentity.bicep' = {
name: 'UAI_Encryption_${timestamp}'
params: {
location: location
name: '${userAssignedIdentityNamePrefix}-encryption'
name: replace(userAssignedIdentityNamePrefix, serviceName, 'encryption')
tags: contains(tags, 'Microsoft.ManagedIdentity/userAssignedIdentities') ? tags['Microsoft.ManagedIdentity/userAssignedIdentities'] : {}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ param logAnalyticsWorkspaceName string
param logAnalyticsWorkspaceRetention int
param logAnalyticsWorkspaceSku string
param networkInterfaceNamePrefix string
param networkName string
param organizationalUnitPath string
param recoveryServices bool
param recoveryServicesPrivateDnsZoneResourceId string
Expand All @@ -52,6 +53,7 @@ param resourceGroupStorage string
param roleDefinitions object
param scalingTool bool
param securityLogAnalyticsWorkspaceResourceId string
param serviceName string
param sessionHostCount int
param storageService string
param subnetResourceId string
Expand Down Expand Up @@ -141,7 +143,7 @@ module deploymentUserAssignedIdentity 'userAssignedIdentity.bicep' = {
name: 'UserAssignedIdentity_${timestamp}'
params: {
location: locationVirtualMachines
name: '${userAssignedIdentityNamePrefix}-deployment'
name: replace(userAssignedIdentityNamePrefix, serviceName, 'deployment')
tags: contains(tags, 'Microsoft.ManagedIdentity/userAssignedIdentities') ? tags['Microsoft.ManagedIdentity/userAssignedIdentities'] : {}
}
}
Expand Down Expand Up @@ -173,6 +175,7 @@ module artifacts 'artifacts.bicep' = {
params: {
location: locationVirtualMachines
resourceGroupManagement: resourceGroupManagement
serviceName: serviceName
storageAccountName: split(artifactsStorageAccountResourceId, '/')[8]
subscriptionId: subscription().subscriptionId
tags: tags
Expand All @@ -192,6 +195,7 @@ module customerManagedKeys 'customerManagedKeys.bicep' = {
keyVaultPrivateDnsZoneResourceId: keyVaultPrivateDnsZoneResourceId
keyVaultPrivateEndpointName: keyVaultPrivateEndpointName
location: locationVirtualMachines
serviceName: serviceName
subnetResourceId: subnetResourceId
tags: tags
timestamp: timestamp
Expand Down Expand Up @@ -230,8 +234,10 @@ module virtualMachine 'virtualMachine.bicep' = {
domainName: domainName
location: locationVirtualMachines
networkInterfaceNamePrefix: networkInterfaceNamePrefix
networkName: networkName
organizationalUnitPath: organizationalUnitPath
securityLogAnalyticsWorkspaceResourceId: securityLogAnalyticsWorkspaceResourceId
serviceName: serviceName
subnet: split(subnetResourceId, '/')[10]
tagsNetworkInterfaces: contains(tags, 'Microsoft.Network/networkInterfaces') ? tags['Microsoft.Network/networkInterfaces'] : {}
tagsVirtualMachines: contains(tags, 'Microsoft.Compute/virtualMachines') ? tags['Microsoft.Compute/virtualMachines'] : {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ param domainJoinUserPrincipalName string
param domainName string
param location string
param networkInterfaceNamePrefix string
param networkName string
param organizationalUnitPath string
param securityLogAnalyticsWorkspaceResourceId string
param serviceName string
param subnet string
param tagsNetworkInterfaces object
param tagsVirtualMachines object
Expand All @@ -25,12 +27,12 @@ param virtualMachineNamePrefix string
param virtualMachinePassword string
param virtualMachineUsername string

var networkInterfaceName = '${networkInterfaceNamePrefix}mgt'
var networkInterfaceName = replace(networkInterfaceNamePrefix, serviceName, 'mgt-vm')
var securitylogAnalyticsWorkspaceName = securityMonitoring ? split(securityLogAnalyticsWorkspaceResourceId, '/')[8] : ''
var securityLogAnalyticsWorkspaceResourceGroupName = securityMonitoring ? split(securityLogAnalyticsWorkspaceResourceId, '/')[4] : resourceGroup().name
var securityLogAnalyticsWorkspaceSubscriptionId = securityMonitoring ? split(securityLogAnalyticsWorkspaceResourceId, '/')[2] : subscription().subscriptionId
var securityMonitoring = empty(securityLogAnalyticsWorkspaceResourceId) ? false : true
var virtualMachineName = '${virtualMachineNamePrefix}mgt'
var virtualMachineName = replace(replace(virtualMachineNamePrefix, serviceName, 'mgt'), networkName, '')

resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2022-10-01' existing = if (securityMonitoring) {
scope: resourceGroup(securityLogAnalyticsWorkspaceSubscriptionId, securityLogAnalyticsWorkspaceResourceGroupName)
Expand Down Expand Up @@ -86,7 +88,7 @@ resource virtualMachine 'Microsoft.Compute/virtualMachines@2021-11-01' = {
}
storageAccountType: diskSku
}
name: '${diskNamePrefix}mgt'
name: replace(diskNamePrefix, serviceName, 'mgt-vm')
}
dataDisks: []
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var resourceAbbreviations = loadJsonContent('../../../data/resourceAbbreviations

var agentSvcPrivateDnsZoneName = 'privatelink.agentsvc.azure-automation.${privateDnsZoneSuffixes_AzureAutomation[environment().name] ?? cloudEndpointSuffix}'
var automationAccountDiagnosticSettingName = replace(replace(namingConvention, resourceAbbreviation, resourceAbbreviations.diagnosticSettings), locationAbbreviation, locations[locationVirtualMachines].abbreviation)
var automationAccountName = replace(replace(replace(namingConvention, resourceAbbreviation, resourceAbbreviations.automationAccounts), serviceName, resourceAbbreviations.automationAccounts), locationAbbreviation, locations[locationVirtualMachines].abbreviation)
var automationAccountName = replace(replace(replace(namingConvention, resourceAbbreviation, resourceAbbreviations.automationAccounts), '-${serviceName}', ''), locationAbbreviation, locations[locationVirtualMachines].abbreviation)
var automationAccountNetworkInterfaceName = replace(replace(replace(namingConvention, resourceAbbreviation, resourceAbbreviations.networkInterfaces), serviceName, 'DSCAndHybridWorker-${resourceAbbreviations.automationAccounts}' ), locationAbbreviation, locations[locationVirtualMachines].abbreviation)
var automationAccountPrivateEndpointName = replace(replace(replace(namingConvention, resourceAbbreviation, resourceAbbreviations.privateEndpoints), serviceName, 'DSCAndHybridWorker-${resourceAbbreviations.automationAccounts}' ), locationAbbreviation, locations[locationVirtualMachines].abbreviation)
var availabilitySetNamePrefix = '${replace(replace(replace(namingConvention, resourceAbbreviation, resourceAbbreviations.availabilitySets), '-${serviceName}', ''), locationAbbreviation, locations[locationVirtualMachines].abbreviation)}-'
Expand All @@ -56,7 +56,7 @@ var dataCollectionRuleName = 'microsoft-avdi-${locations[locationVirtualMachines
var desktopApplicationGroupName = replace(replace(replace(namingConvention, resourceAbbreviation, resourceAbbreviations.desktopApplicationGroups), '-${serviceName}', ''), locationAbbreviation, locations[locationControlPlane].abbreviation)
var diskAccessName = replace(replace(replace(namingConvention, resourceAbbreviation, resourceAbbreviations.diskAccesses), '-${serviceName}', ''), locationAbbreviation, locations[locationVirtualMachines].abbreviation)
var diskEncryptionSetName = replace(replace(replace(namingConvention, resourceAbbreviation, resourceAbbreviations.diskEncryptionSets), '-${serviceName}', ''), locationAbbreviation, locations[locationVirtualMachines].abbreviation)
var diskNamePrefix = '${replace(replace(replace(namingConvention, resourceAbbreviation, resourceAbbreviations.disks), '-${serviceName}', ''), locationAbbreviation, locations[locationVirtualMachines].abbreviation)}-'
var diskNamePrefix = replace(replace(namingConvention, resourceAbbreviation, resourceAbbreviations.disks), locationAbbreviation, locations[locationVirtualMachines].abbreviation)
var filePrivateDnsZoneName = 'privatelink.file.${environment().suffixes.storage}'
var fileShareNames = {
CloudCacheProfileContainer: [
Expand Down Expand Up @@ -85,7 +85,7 @@ var keyVaultPrivateEndpointName = replace(replace(replace(namingConvention, reso
var logAnalyticsWorkspaceName = replace(replace(replace(namingConvention, resourceAbbreviation, resourceAbbreviations.logAnalyticsWorkspaces), '-${serviceName}', ''), locationAbbreviation, locations[locationVirtualMachines].abbreviation)
var netAppAccountName = replace(replace(replace(namingConvention, resourceAbbreviation, resourceAbbreviations.netAppAccounts), '-${serviceName}', ''), locationAbbreviation, locations[locationVirtualMachines].abbreviation)
var netAppCapacityPoolName = replace(replace(replace(namingConvention, resourceAbbreviation, resourceAbbreviations.netAppCapacityPools), '-${serviceName}', ''), locationAbbreviation, locations[locationVirtualMachines].abbreviation)
var networkInterfaceNamePrefix = '${replace(replace(namingConvention, resourceAbbreviation, resourceAbbreviations.networkInterfaces), locationAbbreviation, locations[locationVirtualMachines].abbreviation)}-'
var networkInterfaceNamePrefix = replace(replace(namingConvention, resourceAbbreviation, resourceAbbreviations.networkInterfaces), locationAbbreviation, locations[locationVirtualMachines].abbreviation)
var networkSecurityGroupNames = [
replace(replace(replace(namingConvention, resourceAbbreviation, resourceAbbreviations.networkSecurityGroups), '-${serviceName}', ''), locationAbbreviation, locations[locationControlPlane].abbreviation)
replace(replace(replace(namingConvention, resourceAbbreviation, resourceAbbreviations.networkSecurityGroups), '-${serviceName}', ''), locationAbbreviation, locations[locationVirtualMachines].abbreviation)
Expand Down Expand Up @@ -115,7 +115,7 @@ var storageAccountNamePrefix = replace(replace(replace(replace(replace(namingCon
var storageAccountNetworkInterfaceNamePrefix = replace(replace(replace(replace(namingConvention, resourceAbbreviation, resourceAbbreviations.networkInterfaces), serviceName, resourceAbbreviations.storageAccounts), locationAbbreviation, locations[locationVirtualMachines].abbreviation), environmentShortName, first(environmentShortName))
var storageAccountPrivateEndpointNamePrefix = replace(replace(replace(replace(namingConvention, resourceAbbreviation, resourceAbbreviations.privateEndpoints), serviceName, resourceAbbreviations.storageAccounts), locationAbbreviation, locations[locationVirtualMachines].abbreviation), environmentShortName, first(environmentShortName))
var userAssignedIdentityNamePrefix = replace(replace(namingConvention, resourceAbbreviation, resourceAbbreviations.userAssignedIdentities), locationAbbreviation, locations[locationVirtualMachines].abbreviation)
var virtualMachineNamePrefix = replace(replace(replace(replace(replace(namingConvention, resourceAbbreviation, resourceAbbreviations.virtualMachines), '-${serviceName}', ''), locationAbbreviation, locations[locationVirtualMachines].abbreviation), environmentShortName, first(environmentShortName)), '-', '')
var virtualMachineNamePrefix = replace(replace(replace(replace(namingConvention, resourceAbbreviation, resourceAbbreviations.virtualMachines), locationAbbreviation, locations[locationVirtualMachines].abbreviation), environmentShortName, first(environmentShortName)), '-', '')
var virtualNetworkNames = [
replace(replace(replace(namingConvention, resourceAbbreviation, resourceAbbreviations.virtualNetworks), '-${serviceName}', ''), locationAbbreviation, locations[locationControlPlane].abbreviation)
replace(replace(replace(namingConvention, resourceAbbreviation, resourceAbbreviations.virtualNetworks), '-${serviceName}', ''), locationAbbreviation, locations[locationVirtualMachines].abbreviation)
Expand Down Expand Up @@ -163,6 +163,7 @@ output omsOpinsightsPrivateDnsZoneName string = omsOpinsightsPrivateDnsZoneName
output netAppAccountName string = netAppAccountName
output netAppCapacityPoolName string = netAppCapacityPoolName
output networkInterfaceNamePrefix string = networkInterfaceNamePrefix
output networkName string = networkName
output networkSecurityGroupNames array = networkSecurityGroupNames
output queuePrivateDnsZoneName string = queuePrivateDnsZoneName
output recoveryServicesVaultName string = recoveryServicesVaultName
Expand All @@ -177,6 +178,7 @@ output resourceGroupManagement string = resourceGroupManagement
output resourceGroupsNetwork array = resourceGroupsNetwork
output resourceGroupStorage string = resourceGroupStorage
output routeTables array = routeTables
output serviceName string = serviceName
output storageAccountNamePrefix string = storageAccountNamePrefix
output storageAccountNetworkInterfaceNamePrefix string = storageAccountNetworkInterfaceNamePrefix
output storageAccountPrivateEndpointNamePrefix string = storageAccountPrivateEndpointNamePrefix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ param maxResourcesPerTemplateDeployment int
param monitoring bool
param netAppFileShares array
param networkInterfaceNamePrefix string
param networkName string
param organizationalUnitPath string
param pooledHostPool bool
param enableRecoveryServices bool
Expand All @@ -57,6 +58,7 @@ param scalingMinimumNumberOfRdsh string
param scalingSessionThresholdPerCPU string
param securityPrincipalObjectIds array
param securityLogAnalyticsWorkspaceResourceId string
param serviceName string
param sessionHostBatchCount int
param sessionHostIndex int
param storageAccountPrefix string
Expand Down Expand Up @@ -148,10 +150,12 @@ module virtualMachines 'virtualMachines.bicep' = [for i in range(1, sessionHostB
monitoring: monitoring
netAppFileShares: netAppFileShares
networkInterfaceNamePrefix: networkInterfaceNamePrefix
networkName: networkName
organizationalUnitPath: organizationalUnitPath
resourceGroupControlPlane: resourceGroupControlPlane
resourceGroupManagement: resourceGroupManagement
securityLogAnalyticsWorkspaceResourceId: securityLogAnalyticsWorkspaceResourceId
serviceName: serviceName
sessionHostCount: i == sessionHostBatchCount && divisionRemainderValue > 0 ? divisionRemainderValue : maxResourcesPerTemplateDeployment
sessionHostIndex: i == 1 ? sessionHostIndex : ((i - 1) * maxResourcesPerTemplateDeployment) + sessionHostIndex
storageAccountPrefix: storageAccountPrefix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ param managementVirtualMachineName string
param monitoring bool
param netAppFileShares array
param networkInterfaceNamePrefix string
param networkName string
param organizationalUnitPath string
param resourceGroupControlPlane string
param resourceGroupManagement string
param securityLogAnalyticsWorkspaceResourceId string
param serviceName string
param sessionHostCount int
param sessionHostIndex int
param storageAccountPrefix string
Expand Down Expand Up @@ -112,7 +114,7 @@ resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2021-06
}

resource networkInterface 'Microsoft.Network/networkInterfaces@2020-05-01' = [for i in range(0, sessionHostCount): {
name: '${networkInterfaceNamePrefix}${padLeft((i + sessionHostIndex), 4, '0')}'
name: '${replace(networkInterfaceNamePrefix, '-${serviceName}', '')}-${padLeft((i + sessionHostIndex), 4, '0')}'
location: location
tags: tagsNetworkInterfaces
properties: {
Expand All @@ -135,7 +137,7 @@ resource networkInterface 'Microsoft.Network/networkInterfaces@2020-05-01' = [fo
}]

resource virtualMachine 'Microsoft.Compute/virtualMachines@2021-03-01' = [for i in range(0, sessionHostCount): {
name: '${virtualMachineNamePrefix}${padLeft((i + sessionHostIndex), 4, '0')}'
name: '${replace(virtualMachineNamePrefix, '${serviceName}${networkName}', '')}${padLeft((i + sessionHostIndex), 4, '0')}'
location: location
tags: tagsVirtualMachines
zones: availability == 'AvailabilityZones' ? [
Expand All @@ -157,7 +159,7 @@ resource virtualMachine 'Microsoft.Compute/virtualMachines@2021-03-01' = [for i
storageProfile: {
imageReference: imageReference
osDisk: {
name: '${diskNamePrefix}${padLeft((i + sessionHostIndex), 4, '0')}'
name: '${replace(diskNamePrefix, '-${serviceName}', '')}-${padLeft((i + sessionHostIndex), 4, '0')}'
osType: 'Windows'
createOption: 'FromImage'
caching: 'ReadWrite'
Expand All @@ -172,7 +174,7 @@ resource virtualMachine 'Microsoft.Compute/virtualMachines@2021-03-01' = [for i
dataDisks: []
}
osProfile: {
computerName: '${virtualMachineNamePrefix}${padLeft((i + sessionHostIndex), 4, '0')}'
computerName: '${replace(virtualMachineNamePrefix, '${serviceName}${networkName}', '')}${padLeft((i + sessionHostIndex), 4, '0')}'
adminUsername: virtualMachineUsername
adminPassword: virtualMachinePassword
windowsConfiguration: {
Expand All @@ -185,7 +187,7 @@ resource virtualMachine 'Microsoft.Compute/virtualMachines@2021-03-01' = [for i
networkProfile: {
networkInterfaces: [
{
id: resourceId('Microsoft.Network/networkInterfaces', '${networkInterfaceNamePrefix}${padLeft((i + sessionHostIndex), 4, '0')}')
id: networkInterface[i].id
properties: {
deleteOption: 'Delete'
}
Expand Down
Loading

0 comments on commit 33bdceb

Please sign in to comment.