From 3d8aa95f0bf6bfa2d154b6584edc021d799cf629 Mon Sep 17 00:00:00 2001 From: briggsb9 Date: Fri, 15 Mar 2024 18:56:16 +0000 Subject: [PATCH 1/2] Naming and param corrections --- .../bicep/backend/backend.bicep | 13 +++--- .../AppGW-IAPIM-Func/bicep/main.bicep | 17 +++++--- .../bicep/networking/networking.bicep | 43 ++++++++++--------- .../AppGW-IAPIM-Func/bicep/parameters.json | 5 ++- .../bicep/shared/shared.bicep | 2 +- 5 files changed, 45 insertions(+), 35 deletions(-) diff --git a/reference-implementations/AppGW-IAPIM-Func/bicep/backend/backend.bicep b/reference-implementations/AppGW-IAPIM-Func/bicep/backend/backend.bicep index c7a8362e..ed6c9e49 100644 --- a/reference-implementations/AppGW-IAPIM-Func/bicep/backend/backend.bicep +++ b/reference-implementations/AppGW-IAPIM-Func/bicep/backend/backend.bicep @@ -22,11 +22,12 @@ param vnetName string param vnetRG string param location string +param resourceSuffix string // // Variables // -var owner = 'APIM Const Set' +var owner = 'APIM LZ' // // Azure Storage @@ -50,16 +51,16 @@ var functionContentShareName = 'func-contents' // // - min TLS version var storageAccounts_minTLSVersion = 'TLS1_2' -var privateEndpoint_storageaccount_queue_Name = 'pep-sa-queue-${workloadName}-${environment}-${location}' -var privateEndpoint_storageaccount_blob_Name = 'pep-sa-blob-${workloadName}-${environment}-${location}' -var privateEndpoint_storageaccount_file_Name = 'pep-sa-file-${workloadName}-${environment}-${location}' -var privateEndpoint_storageaccount_table_Name = 'pep-sa-table-${workloadName}-${environment}-${location}' +var privateEndpoint_storageaccount_queue_Name = 'pep-sa-queue-${resourceSuffix}' +var privateEndpoint_storageaccount_blob_Name = 'pep-sa-blob-${resourceSuffix}' +var privateEndpoint_storageaccount_file_Name = 'pep-sa-file-${resourceSuffix}' +var privateEndpoint_storageaccount_table_Name = 'pep-sa-table-${resourceSuffix}' // // Azure Application Service Plan // // - name -var serverfarms_appsvcplanAPIMCSBackend_name = 'plan-be-${workloadName}-${environment}-${location}' +var serverfarms_appsvcplanAPIMCSBackend_name = 'plan-be-${resourceSuffix}' // - location var serverfarms_appsvcplanAPIMCSBackend_location = location // Azure Application Service Plan sizing diff --git a/reference-implementations/AppGW-IAPIM-Func/bicep/main.bicep b/reference-implementations/AppGW-IAPIM-Func/bicep/main.bicep index 55ff68c1..0d14c176 100644 --- a/reference-implementations/AppGW-IAPIM-Func/bicep/main.bicep +++ b/reference-implementations/AppGW-IAPIM-Func/bicep/main.bicep @@ -2,8 +2,8 @@ targetScope = 'subscription' // Parameters @description('A short name for the workload being deployed alphanumberic only') -@maxLength(8) -param workloadName string +@maxLength(6) +param workloadName string = 'apimlz' @description('The environment for which the deployment is being executed') @allowed([ @@ -53,19 +53,21 @@ param location string = deployment().location param resourceGroupTags object = {} +param instanceNumber string = '01' + // Variables -var resourceSuffix = '${workloadName}-${environment}-${location}-${uniqueString(subscription().id)}' +var resourceSuffix = '${workloadName}-${environment}-${location}-${instanceNumber}' + var networkingResourceGroupName = 'rg-networking-${resourceSuffix}' var sharedResourceGroupName = 'rg-shared-${resourceSuffix}' - var backendResourceGroupName = 'rg-backend-${resourceSuffix}' - var apimResourceGroupName = 'rg-apim-${resourceSuffix}' -// Resource Names var apimName = 'apim-${resourceSuffix}' var appGatewayName = 'appgw-${resourceSuffix}' +// Resource Group Deployments + resource networkingRG 'Microsoft.Resources/resourceGroups@2021-04-01' = { name: networkingResourceGroupName location: location @@ -90,6 +92,7 @@ resource apimRG 'Microsoft.Resources/resourceGroups@2021-04-01' = { tags: resourceGroupTags } +// Module Deployments module networking './networking/networking.bicep' = { name: 'networkingresources' scope: resourceGroup(networkingRG.name) @@ -97,7 +100,6 @@ module networking './networking/networking.bicep' = { workloadName: workloadName deploymentEnvironment: environment location: location - apimName: apimName } } @@ -112,6 +114,7 @@ module backend './backend/backend.bicep' = { vnetRG: networkingRG.name backendSubnetId: networking.outputs.backEndSubnetid privateEndpointSubnetid: networking.outputs.privateEndpointSubnetid + resourceSuffix: resourceSuffix } } diff --git a/reference-implementations/AppGW-IAPIM-Func/bicep/networking/networking.bicep b/reference-implementations/AppGW-IAPIM-Func/bicep/networking/networking.bicep index 6c5c4c4e..09cb607e 100644 --- a/reference-implementations/AppGW-IAPIM-Func/bicep/networking/networking.bicep +++ b/reference-implementations/AppGW-IAPIM-Func/bicep/networking/networking.bicep @@ -42,7 +42,7 @@ param privateEndpointAddressPrefix string = '10.2.5.0/24' param backEndAddressPrefix string = '10.2.6.0/24' param apimAddressPrefix string = '10.2.7.0/24' param location string -param apimName string +param instanceNumber string = '001' /* @description('A short name for the PL that will be created between Funcs') @@ -52,30 +52,33 @@ param functionId string = '123131' */ // Variables -var owner = 'APIM Const Set' +var owner = 'APIM LZ' -var apimCSVNetName = 'vnet-apim-cs-${workloadName}-${deploymentEnvironment}-${location}' +var resourceSuffix = '${workloadName}-${deploymentEnvironment}-${location}-${instanceNumber}' + +var apimCSVNetName = 'vnet-apim-cs-${workloadName}-${deploymentEnvironment}-${location}-${instanceNumber}' +var bastionName = 'bastion-${resourceSuffix}' +var publicIPAddressName = 'pip-apimcs-${resourceSuffix}' // 'publicIp' +var publicIPAddressNameBastion = 'pip-bastion-${resourceSuffix}' // 'publicIpBastion +var bastionIPConfigName = 'bastionipcfg-${resourceSuffix}' var bastionSubnetName = 'AzureBastionSubnet' // Azure Bastion subnet must have AzureBastionSubnet name, not 'snet-bast-${workloadName}-${deploymentEnvironment}-${location}' var devOpsSubnetName = 'snet-devops-${workloadName}-${deploymentEnvironment}-${location}' -var jumpBoxSubnetName = 'snet-jbox-${workloadName}-${deploymentEnvironment}-${location}-001' -var appGatewaySubnetName = 'snet-apgw-${workloadName}-${deploymentEnvironment}-${location}-001' -var privateEndpointSubnetName = 'snet-prep-${workloadName}-${deploymentEnvironment}-${location}-001' -var backEndSubnetName = 'snet-bcke-${workloadName}-${deploymentEnvironment}-${location}-001' -var apimSubnetName = 'snet-apim-${workloadName}-${deploymentEnvironment}-${location}-001' -var bastionName = 'bastion-${workloadName}-${deploymentEnvironment}-${location}' -var bastionIPConfigName = 'bastionipcfg-${workloadName}-${deploymentEnvironment}-${location}' +var jumpBoxSubnetName = 'snet-jbox-${workloadName}-${deploymentEnvironment}-${location}' +var appGatewaySubnetName = 'snet-apgw-${workloadName}-${deploymentEnvironment}-${location}' +var privateEndpointSubnetName = 'snet-prep-${workloadName}-${deploymentEnvironment}-${location}' +var backEndSubnetName = 'snet-bcke-${workloadName}-${deploymentEnvironment}-${location}' +var apimSubnetName = 'snet-apim-${workloadName}-${deploymentEnvironment}-${location}' -var bastionSNNSG = 'nsg-bast-${workloadName}-${deploymentEnvironment}-${location}' -var devOpsSNNSG = 'nsg-devops-${workloadName}-${deploymentEnvironment}-${location}' -var jumpBoxSNNSG = 'nsg-jbox-${workloadName}-${deploymentEnvironment}-${location}' -var appGatewaySNNSG = 'nsg-apgw-${workloadName}-${deploymentEnvironment}-${location}' -var privateEndpointSNNSG = 'nsg-prep-${workloadName}-${deploymentEnvironment}-${location}' -var backEndSNNSG = 'nsg-bcke-${workloadName}-${deploymentEnvironment}-${location}' -var apimSNNSG = 'nsg-apim-${workloadName}-${deploymentEnvironment}-${location}' +var bastionSNNSG = 'nsg-bast-${resourceSuffix}' +var devOpsSNNSG = 'nsg-devops-${resourceSuffix}' +var jumpBoxSNNSG = 'nsg-jbox-${resourceSuffix}' +var appGatewaySNNSG = 'nsg-apgw-${resourceSuffix}' +var privateEndpointSNNSG = 'nsg-prep-${resourceSuffix}' +var backEndSNNSG = 'nsg-bcke-${resourceSuffix}' +var apimSNNSG = 'nsg-apim-${resourceSuffix}' -var publicIPAddressName = 'pip-apimcs-${workloadName}-${deploymentEnvironment}-${location}' // 'publicIp' -var publicIPAddressNameBastion = 'pip-bastion-${workloadName}-${deploymentEnvironment}-${location}' +var publicIPAddressDNSLabel = 'doesnotmatter${uniqueString(subscription().id)}0' // Label is required but name does not matter // Resources - VNet - SubNets resource vnetApimCs 'Microsoft.Network/virtualNetworks@2021-02-01' = { @@ -470,7 +473,7 @@ resource pip 'Microsoft.Network/publicIPAddresses@2020-07-01' = { properties: { publicIPAllocationMethod: 'Static' dnsSettings: { - domainNameLabel: '${publicIPAddressName}dns' + domainNameLabel: publicIPAddressDNSLabel } } } diff --git a/reference-implementations/AppGW-IAPIM-Func/bicep/parameters.json b/reference-implementations/AppGW-IAPIM-Func/bicep/parameters.json index cdea73ad..1f91fd4a 100644 --- a/reference-implementations/AppGW-IAPIM-Func/bicep/parameters.json +++ b/reference-implementations/AppGW-IAPIM-Func/bicep/parameters.json @@ -15,7 +15,7 @@ "value": "ENTERPAT" }, "workloadName" :{ - "value": "demoWL" + "value": "apimlz" }, "CICDAgentType": { "value": "azuredevops OR github OR none" @@ -28,6 +28,9 @@ }, "appGatewayCertType" :{ "value": "selfsigned or custom" + }, + "instanceNumber" :{ + "value": "instance number E.G 01" } } } \ No newline at end of file diff --git a/reference-implementations/AppGW-IAPIM-Func/bicep/shared/shared.bicep b/reference-implementations/AppGW-IAPIM-Func/bicep/shared/shared.bicep index 07cc660e..13ee60d5 100644 --- a/reference-implementations/AppGW-IAPIM-Func/bicep/shared/shared.bicep +++ b/reference-implementations/AppGW-IAPIM-Func/bicep/shared/shared.bicep @@ -89,7 +89,7 @@ module vm_jumpboxwinvm './createvmwindows.bicep' = { username: vmUsername password: vmPassword CICDAgentType: CICDAgentType - vmName: 'jumpbox-${environment}' + vmName: 'jumpbox-${resourceSuffix}' vmSize: vmSize } } From 8f8e007b5d7b71cabd112a446c2350b16fb1685c Mon Sep 17 00:00:00 2001 From: briggsb9 Date: Fri, 15 Mar 2024 19:06:01 +0000 Subject: [PATCH 2/2] Name corrections --- .../AppGW-IAPIM-Func/bicep/networking/networking.bicep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference-implementations/AppGW-IAPIM-Func/bicep/networking/networking.bicep b/reference-implementations/AppGW-IAPIM-Func/bicep/networking/networking.bicep index 09cb607e..0dae3a34 100644 --- a/reference-implementations/AppGW-IAPIM-Func/bicep/networking/networking.bicep +++ b/reference-implementations/AppGW-IAPIM-Func/bicep/networking/networking.bicep @@ -42,7 +42,7 @@ param privateEndpointAddressPrefix string = '10.2.5.0/24' param backEndAddressPrefix string = '10.2.6.0/24' param apimAddressPrefix string = '10.2.7.0/24' param location string -param instanceNumber string = '001' +param instanceNumber string = '01' /* @description('A short name for the PL that will be created between Funcs')