Skip to content

Sample for multi subscription prerequisites #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 14 additions & 26 deletions docs/prerequisites/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,17 @@ param administratorUsername string = 'VmMainUser'
@secure()
@description('Specifies the administrator password of the virtual machine.')
param administratorPassword string
@description('Specifies the subscription ID of the data management zone.')
param dataManagementZoneSubscription string
@description('Specifies the subscription ID of the data landing zone.')
param dataLandingZone01Subscription string

// Variables
var name = toLower('${prefix}-${environment}')
var bastionResourceGroupName = '${name}-bastion-rg'
var cicdResourceGroupName = '${name}-cicd-rg'
var networkResourceGroupName = '${name}-network-rg'
var globalDnsResourceGroupName = '${name}-global-dns-rg'
var dataManagementZoneNetworkResourceGroupName = '${name}-dmgmt-network-rg'
var dataLandingZone01NetworkResourceGroupName = '${name}-dlz01-network-rg'

// CICD resources
resource cicdResourceGroup 'Microsoft.Resources/resourceGroups@2021-01-01' = {
Expand Down Expand Up @@ -108,8 +110,8 @@ module networkConfiguration 'modules/networkConfiguration.bicep' = {
hubVirtualNetworkId: networkServices.outputs.vnetId
virtualNetworkManagerId: networkServices.outputs.virtualNetworkManagerId
spokeVirtualNetworkIds: [
dataManagementZoneNetworkResources.outputs.vnetId
dataLandingZone01NetworkResources.outputs.vnetId
dataManagementZoneSpokeNetwork.outputs.vnetId
dataLandingZone01SpokeNetwork.outputs.vnetId
]
}
}
Expand All @@ -131,17 +133,10 @@ module globalDnsZones 'modules/privatednszones.bicep' = {
}
}

// Data Management Zone Virtual Network
resource dataManagementZoneNetworkResourceGroup 'Microsoft.Resources/resourceGroups@2021-01-01' = {
name: dataManagementZoneNetworkResourceGroupName
location: location
tags: tags
properties: {}
}

module dataManagementZoneNetworkResources 'modules/networkSpoke.bicep' = {
name: 'dataManagementZoneNetworkResources'
scope: dataManagementZoneNetworkResourceGroup
// Data Management Zone Spoke Network
module dataManagementZoneSpokeNetwork 'modules/spokeRoot.bicep' = {
name: 'dataManagementZoneSpokeNetwork'
scope: subscription(dataManagementZoneSubscription)
params: {
location: location
prefix: '${name}-dmgmt'
Expand All @@ -151,17 +146,10 @@ module dataManagementZoneNetworkResources 'modules/networkSpoke.bicep' = {
}
}

// Data Landing Zone Virtual Network
resource dataLandingZone01NetworkResourceGroup 'Microsoft.Resources/resourceGroups@2021-01-01' = {
name: dataLandingZone01NetworkResourceGroupName
location: location
tags: tags
properties: {}
}

module dataLandingZone01NetworkResources 'modules/networkSpoke.bicep' = {
name: 'dataLandingZone01NetworkResources'
scope: dataLandingZone01NetworkResourceGroup
// Data Landing Zone 01 Spoke Network
module dataLandingZone01SpokeNetwork 'modules/spokeRoot.bicep' = {
name: 'dataLandingZone01SpokeNetwork'
scope: subscription(dataLandingZone01Subscription)
params: {
location: location
prefix: '${name}-dlz01'
Expand Down
35 changes: 35 additions & 0 deletions docs/prerequisites/modules/spokeRoot.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
targetScope = 'subscription'

// Parameters
param location string
param prefix string
param tags object

param firewallPrivateIp string
param vnetAddressPrefix string

// Variables
var networkResourceGroupName = '${prefix}-network-rg'

// Resources
resource networkResourceGroup 'Microsoft.Resources/resourceGroups@2021-01-01' = {
name: networkResourceGroupName
location: location
tags: tags
properties: {}
}

module networkResources 'networkSpoke.bicep' = {
name: 'networkResources'
scope: networkResourceGroup
params: {
location: location
prefix: prefix
tags: tags
firewallPrivateIp: firewallPrivateIp
vnetAddressPrefix: vnetAddressPrefix
}
}

// Outputs
output vnetId string = networkResources.outputs.vnetId
6 changes: 6 additions & 0 deletions docs/prerequisites/params.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
},
"administratorPassword": {
"value": "<your-secret-passsword>"
},
"dataManagementZoneSubscription": {
"value": "<your-dmz-subscription-id>"
},
"dataLandingZone01Subscription": {
"value": "<your-dlz01-subscription-id>"
}
}
}