Skip to content

Commit 50ce231

Browse files
Merge pull request #262 from microsoft/psl-networkmodulerestructure
fix: Updated the reusuable network design documentation
2 parents 4616256 + 60b3c6a commit 50ce231

6 files changed

Lines changed: 19 additions & 13 deletions

File tree

infra/samples/network-subnet-design.bicep

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
// /******************************************************************************************************************/
22
// This is an example test program to create private networking resources independently with sample network design.
3-
// It is an illustration of how to use the main.bicep in the infra/modules/network folder, with your own parameters.
3+
// It is an illustration of how to use the network-resources.bicep in the infra/samples/network folder, with your own parameters.
44
// You can independently deploy this module to create a network with subnets, NSGs, Azure Bastion Host, and Jumpbox VM.
55
// Test them with this test program. Then integrate your design into the modules/network.bicep which is intended for
66
// a specific network design.
77
//
8-
// All things in infra/modules/network are designed to be reusable and composable without the need to modify
8+
// All things in infra/samples/network are designed to be reusable and composable without the need to modify
99
// any code in the network folder.
1010
//
1111
// Please review below modules to understand how things are wired together:
1212
// infra/main.bicep
1313
// infra/modules/network.bicep
14-
// infra/moddules/network/main.bicep
14+
// infra/samples/network/network-resources.bicep
1515
//
1616
// /******************************************************************************************************************/
1717

@@ -39,7 +39,7 @@ param vmAdminUsername string = 'JumpboxAdminUser'
3939
param vmAdminPassword string = 'JumpboxAdminP@ssw0rd1234!'
4040

4141

42-
import { bastionHostConfigurationType } from '../modules/network/bastionHost.bicep'
42+
import { bastionHostConfigurationType } from 'network/bastionHost.bicep'
4343
@description('Optional. Configuration for the Azure Bastion Host. Leave null to omit Bastion creation.')
4444
param bastionConfiguration bastionHostConfigurationType = {
4545
name: 'bastion-${resourcesName}'
@@ -106,7 +106,7 @@ param bastionConfiguration bastionHostConfigurationType = {
106106
}
107107
}
108108

109-
import { jumpBoxConfigurationType } from '../modules/network/jumpbox.bicep'
109+
import { jumpBoxConfigurationType } from 'network/jumpbox.bicep'
110110
@description('Optional. Configuration for the Jumpbox VM. Leave null to omit Jumpbox creation.')
111111
param jumpboxConfiguration jumpBoxConfigurationType = {
112112
name: 'vm-jumpbox-${resourcesName}'
@@ -174,7 +174,7 @@ param addressPrefixes array = ['10.0.0.0/20'] // 4096 addresses (enough for 8 /2
174174
// - Document subnet usage and purpose in code comments.
175175
// - For AVM modules, ensure only one delegation per subnet and leave delegations empty if not required.
176176

177-
import { subnetType } from '../modules/network/virtualNetwork.bicep'
177+
import { subnetType } from 'network/virtualNetwork.bicep'
178178
@description('Array of subnets to be created within the VNET.')
179179
param subnets subnetType[] = [
180180
{
@@ -325,7 +325,7 @@ module logAnalyticsWorkspace 'br/public:avm/res/operational-insights/workspace:0
325325
// Networking - NSGs, VNET and Subnets. Each subnet has its own NSG
326326
// /******************************************************************************************************************/
327327

328-
module network '../modules/network/network-resources.bicep' = {
328+
module network 'network/network-resources.bicep' = {
329329
name: take('network-${resourcesName}-create', 64)
330330
params: {
331331
resourcesName: resourcesName
File renamed without changes.
File renamed without changes.

infra/samples/network_subnet_design.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ This guide explains how to use the sample Bicep program `network-subnet-design.b
55
## Purpose and Approach
66

77
- **Sample File:** `infra/samples/network-subnet-design.bicep`
8-
- **Reusable Modules:** All code in `infra/modules/network` is designed to be reusable. You should not need to modify code in the modules folder.
8+
- **Reusable Modules:** All code in `infra/samples/network` is designed to be reusable. You should not need to modify code in the modules folder.
99
- **Custom Network File:** For your own solution, create a `network.bicep` in `infra/modules/` that represents your specific network design, using the modules as building blocks.
1010

1111
## How to Use the Sample
1212

1313
- The sample demonstrates how to deploy a virtual network, subnets, NSGs, Azure Bastion Host, and Jumpbox VM using parameters and reusable modules.
1414
- The sample is parameterized, so you can easily adjust subnet names, address spaces, NSG rules, and delegations.
15-
- You can design and validate your network design with `infra/samples/network-subnet-design.bicep`, then integrate the code by updating `infra/modules/network.bicep` with your tested design.
15+
- You can design and validate your network design with `infra/samples/network-subnet-design.bicep`, then integrate the code by creating `infra/modules/network.bicep` with your tested design (network-subnet-design.bicep).
1616

1717
## Key Features in the Sample
1818

@@ -35,17 +35,23 @@ This guide explains how to use the sample Bicep program `network-subnet-design.b
3535
- Adjust the subnet array, address prefixes, NSG rules, and other parameters to match your requirements.
3636
3. **Deploy the Sample:**
3737
- Use Azure Developer CLI (`azd`) or Azure CLI to deploy the sample and validate your design.
38-
4. **Integrate into Solution:**
39-
- Once validated, use the same approach to build your own `network.bicep` in `infra/modules/` for your solution. Test your solution with `infra/main.bicep`.
38+
4. **Integrate into Your Solution:**
39+
- Once validated, create your own `network.bicep` in `infra/modules/` using the tested design (network-subnet-design.bicep).
40+
- **Key Integration Steps:**
41+
- Remove any standalone calls to `virtualNetwork.bicep`, `bastionHost`, and `jumpboxVM` modules from main.bicep file
42+
- Replace them with a single call to `infra/modules/network.bicep` (netwly created network design bicep)
43+
- This approach uses the tested, reusable modules without code duplication.
44+
- Test your integrated solution with `infra/main.bicep`.
4045

4146
## Example Directory Structure
4247

4348
```
4449
infra/
45-
modules/
50+
samples/
4651
network/
4752
... (reusable modules)
48-
network.bicep # <-- your custom network design
53+
modules/
54+
network.bicep # <--Create your own custom network design
4955
samples/
5056
network-subnet-design.bicep # <-- reference
5157
```

0 commit comments

Comments
 (0)