Skip to content

Commit 28e86c3

Browse files
v-fearamskabou
andauthored
Update azure-hub-spoke (#243)
* update rg name y moving to bicep * Azure DDoS Protection Standard should be enabled --------- Co-authored-by: Federico Arambarri <v-fearam> Co-authored-by: Jason Bouska <[email protected]>
1 parent 03d1d62 commit 28e86c3

File tree

2 files changed

+41
-16
lines changed

2 files changed

+41
-16
lines changed

solutions/azure-hub-spoke/README.md

+23-16
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,13 @@ For detailed information, see the Azure Hub and Spoke reference architecture in
2929

3030
Create a resource group for the deployment.
3131

32-
```azurecli-interactive
33-
az group create --name hub-spoke --location eastus
32+
```bash
33+
LOCATION=eastus2
34+
RESOURCEGROUP_NAME=rg-hub-spoke-${LOCATION}
35+
36+
az group create --name ${RESOURCEGROUP_NAME} --location ${LOCATION}
37+
38+
curl -o main.bicep https://raw.githubusercontent.com/mspnp/samples/main/solutions/azure-hub-spoke/bicep/main.bicep
3439
```
3540

3641
> The location for the deployed resources defaults to the location used for the target resource group. This deployment uses availability zones for all resources that support it, as hub networks are usually business critical. This means if the resource group's location does not support availability zones, you must provide an additional parameter to your chosen command below of `location=value` with a value supports availability zones. See [Azure regions with availability zones](https://learn.microsoft.com/azure/availability-zones/az-overview#azure-regions-with-availability-zones).
@@ -39,10 +44,10 @@ az group create --name hub-spoke --location eastus
3944

4045
Run the following command to initiate the deployment. If you would like to also deploy this sample with virtual machines and / or an Azure VPN gateway, see the `az deployment group create` examples found later in this document.
4146

42-
```azurecli-interactive
47+
```bash
4348
az deployment group create \
44-
--resource-group hub-spoke \
45-
--template-uri https://raw.githubusercontent.com/mspnp/samples/main/solutions/azure-hub-spoke/azuredeploy.json
49+
--resource-group ${RESOURCEGROUP_NAME} \
50+
--template-file main.bicep
4651
```
4752

4853
**Deploy with virtual machines**
@@ -52,21 +57,21 @@ Run the following command to initiate the deployment with a Linux VM deployed to
5257
| :warning: | This deploys these VMs with basic configuration, they are not Internet facing, but security should always be top of mind. Please update the `adminUsername` and `adminPassword` to a value of your choosing. |
5358
|-----------|:--------------------------|
5459

55-
```azurecli-interactive
60+
```bash
5661
az deployment group create \
57-
--resource-group hub-spoke \
58-
--template-uri https://raw.githubusercontent.com/mspnp/samples/main/solutions/azure-hub-spoke/azuredeploy.json \
62+
--resource-group ${RESOURCEGROUP_NAME} \
63+
--template-file main.bicep \
5964
--parameters deployVirtualMachines=true adminUsername=azureadmin adminPassword=Password2023!
6065
```
6166

6267
**Deploy with VPN gateway**
6368

6469
Run the following command to initiate the deployment with a virtual network gateway deployed into the hub virtual network. Note, VPN gateways take a significant time to deploy.
6570

66-
```azurecli-interactive
71+
```bash
6772
az deployment group create \
68-
--resource-group hub-spoke \
69-
--template-uri https://raw.githubusercontent.com/mspnp/samples/main/solutions/azure-hub-spoke/azuredeploy.json \
73+
--resource-group ${RESOURCEGROUP_NAME} \
74+
--template-file main.bicep \
7075
--parameters deployVpnGateway=true
7176
```
7277

@@ -77,10 +82,10 @@ Run the following command to initiate the deployment with a Linux VM deployed to
7782
| :warning: | This deploys these VMs with basic configuration, they are not Internet facing, but security should always be top of mind. Please update the `adminUsername` and `adminPassword` to a value of your choosing. |
7883
|-----------|:--------------------------|
7984

80-
```azurecli-interactive
85+
```bash
8186
az deployment group create \
82-
--resource-group hub-spoke \
83-
--template-uri https://raw.githubusercontent.com/mspnp/samples/main/solutions/azure-hub-spoke/azuredeploy.json \
87+
--resource-group ${RESOURCEGROUP_NAME} \
88+
--template-file main.bicep \
8489
--parameters deployVirtualMachines=true adminUsername=azureadmin adminPassword=Password2023! deployVpnGateway=true
8590
```
8691

@@ -106,9 +111,11 @@ The following resources are configured to send diagnostic logs to the included L
106111

107112
Note, this deployment includes optional basic virtual machines. These are not configured with a Log Analytics workspace, however, can be with the Log Analytics virtual machine extension for [Windows](https://learn.microsoft.com/azure/virtual-machines/extensions/oms-windows) and [Linux](https://learn.microsoft.com/azure/virtual-machines/extensions/oms-linux).
108113

109-
## Bicep implementation
114+
## Clean up
110115

111-
The links above use JSON Azure Resource Manager (ARM) templates to support network referencing. The ARM templates were generated from the following [source bicep file](https://github.com/mspnp/samples/blob/main/solutions/azure-hub-spoke/bicep/main.bicep), which has additional comments and considerations.
116+
```bash
117+
az group delete --name ${RESOURCEGROUP_NAME} --yes
118+
```
112119

113120
## Microsoft Open Source Code of Conduct
114121

solutions/azure-hub-spoke/bicep/main.bicep

+18
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,12 @@ resource nsgBastionSubnet_diagnosticSettings 'Microsoft.Insights/diagnosticSetti
282282
}
283283
}
284284

285+
// Azure DDoS Protection Standard should be enabled
286+
resource ddosProtectionPlan 'Microsoft.Network/ddosProtectionPlans@2021-05-01' = {
287+
name: 'vnet-${location}-ddos'
288+
location: location
289+
}
290+
285291
@description('The regional hub network.')
286292
resource vnetHub 'Microsoft.Network/virtualNetworks@2023-04-01' = {
287293
name: 'vnet-${location}-hub'
@@ -315,6 +321,10 @@ resource vnetHub 'Microsoft.Network/virtualNetworks@2023-04-01' = {
315321
}
316322
}
317323
]
324+
enableDdosProtection: true
325+
ddosProtectionPlan: {
326+
id: ddosProtectionPlan.id
327+
}
318328
}
319329

320330
resource azureBastionSubnet 'subnets' existing = {
@@ -955,6 +965,10 @@ resource vnetSpokeOne 'Microsoft.Network/virtualNetworks@2023-04-01' = {
955965
}
956966
}
957967
]
968+
enableDdosProtection: true
969+
ddosProtectionPlan: {
970+
id: ddosProtectionPlan.id
971+
}
958972
}
959973

960974
resource snetResources 'subnets' existing = {
@@ -1127,6 +1141,10 @@ resource vnetSpokeTwo 'Microsoft.Network/virtualNetworks@2023-04-01' = {
11271141
}
11281142
}
11291143
]
1144+
enableDdosProtection: true
1145+
ddosProtectionPlan: {
1146+
id: ddosProtectionPlan.id
1147+
}
11301148
}
11311149

11321150
resource snetResources 'subnets' existing = {

0 commit comments

Comments
 (0)