Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
0525c29
network bicep wip
mbrat2005 Jul 25, 2022
c0562f9
location param
mbrat2005 Jul 25, 2022
416e80d
nsg sr priority
mbrat2005 Jul 25, 2022
90668e3
nsg sr priority
mbrat2005 Jul 25, 2022
c4cbb03
Merge branch 'network-bicep' of https://github.com/mbrat2005/WhatTheH…
mbrat2005 Jul 25, 2022
ee37290
nsg rule priority
mbrat2005 Jul 25, 2022
5057d40
vm extension
mbrat2005 Jul 25, 2022
f0e95e7
extn, gw sku
mbrat2005 Jul 25, 2022
20f3549
rg names
mbrat2005 Jul 25, 2022
895a577
change rdp port cse
mbrat2005 Jul 25, 2022
2b9f401
extn name
mbrat2005 Jul 25, 2022
f0ddede
enccmd
mbrat2005 Jul 25, 2022
0909fe8
cmd fix
mbrat2005 Jul 25, 2022
6fe59dd
csr
mbrat2005 Jul 25, 2022
a7c635d
csr pip
mbrat2005 Jul 25, 2022
2f99d27
csr
mbrat2005 Jul 25, 2022
8b2ea69
csr
mbrat2005 Jul 25, 2022
f89928b
csr
mbrat2005 Jul 25, 2022
20d5db8
deploy script
mbrat2005 Jul 26, 2022
5b02eeb
deployment tested
mbrat2005 Jul 26, 2022
90b5b10
wip: csr config
mbrat2005 Jul 28, 2022
c2ec3fb
cxn sharedkey property
mbrat2005 Jul 28, 2022
ea641e6
allow ping
mbrat2005 Jul 28, 2022
de0cfa9
cleanup
mbrat2005 Jul 28, 2022
8ff8dd8
csr terms
mbrat2005 Jul 28, 2022
44bc47b
csr terms - cisco misspell
mbrat2005 Jul 28, 2022
55646ce
on-prem routing
mbrat2005 Jul 28, 2022
9906139
throw on error
mbrat2005 Jul 29, 2022
b4005ec
challenge 2
mbrat2005 Jul 29, 2022
8f2f67c
readme
mbrat2005 Jul 29, 2022
2240dd2
Merge branch 'microsoft:master' into network-bicep
mbrat2005 Jul 29, 2022
1eede8c
Merge branch 'network-bicep' of https://github.com/mbrat2005/WhatTheH…
mbrat2005 Jul 29, 2022
97bd22e
error handling
mbrat2005 Aug 1, 2022
1d8a8cf
location param
mbrat2005 Aug 1, 2022
05b4f73
location param
mbrat2005 Aug 1, 2022
9e3548e
error messages
mbrat2005 Aug 2, 2022
368ba7a
removed location param from fwpol
mbrat2005 Aug 4, 2022
945a967
switch to run-command for inspector gaget
mbrat2005 Aug 5, 2022
0ea4b55
run-command remove commandid
mbrat2005 Aug 5, 2022
90de98b
clarify username
mbrat2005 Aug 5, 2022
3409491
deployed resources documentation
mbrat2005 Aug 5, 2022
382ae7f
Merge branch 'master' of https://github.com/mbrat2005/WhatTheHack int…
mbrat2005 Sep 13, 2022
9499d8e
challenge 3
mbrat2005 Sep 13, 2022
cbea0af
unused resource refs cleanup
mbrat2005 Sep 13, 2022
2df4638
wip: challenge 4
mbrat2005 Sep 14, 2022
9901e58
challenge 4
mbrat2005 Sep 15, 2022
bd96351
wip: challenge 5
mbrat2005 Sep 16, 2022
7cc3f7f
challenge 5 sql
mbrat2005 Sep 20, 2022
7a25b9a
afw logging
mbrat2005 Sep 29, 2022
972ad8a
Update 01-01-spoke2.bicep
mbrat2005 Sep 30, 2022
e35ddd8
correct spoke routes
mbrat2005 Dec 16, 2022
231c254
cleanup doc
mbrat2005 Dec 16, 2022
ee536b0
wip:webapp
mbrat2005 Dec 16, 2022
30209f5
rg deployment name
mbrat2005 Dec 19, 2022
a1f755c
fix spoke 2 nsg ref
mbrat2005 Dec 19, 2022
4b0cadb
fix premium afw ref
mbrat2005 Dec 19, 2022
aebc6e1
fix afw int ip ref
mbrat2005 Dec 19, 2022
c51d1fd
fix afw ip refs
mbrat2005 Dec 19, 2022
6da4ad4
automated certificate issuance
mbrat2005 Dec 22, 2022
5e64e5e
add self-signed cert option
mbrat2005 Dec 27, 2022
0162028
fix paas link casing
mbrat2005 Dec 27, 2022
f5903e3
wip: challenge 5
mbrat2005 Dec 27, 2022
687ce55
wip: challenge 5 appsvc sql conn
mbrat2005 Dec 28, 2022
ae4e35e
challenge 5 completed
mbrat2005 Dec 28, 2022
3cb6c72
challenge 5 bonus
mbrat2005 Dec 29, 2022
e0d2b51
challenge 5 fix nsg
mbrat2005 Dec 29, 2022
75d5546
readme updates
mbrat2005 Dec 29, 2022
44c6865
challenge 5 docs and images
mbrat2005 Dec 30, 2022
142d5c8
challenge 4: fix permissions and dependancies
mbrat2005 Dec 30, 2022
17b701e
move to Coaches, remove .gitattribute
mbrat2005 Jan 10, 2023
269ef8d
Merge branch 'master' into network-bicep
mbrat2005 Jan 10, 2023
59091a7
DOCKERFILE line ending
mbrat2005 Jan 10, 2023
fca706e
coaches bicep solution documentation
mbrat2005 Jan 10, 2023
4e97ead
added nsg for on prem vpn subnet
mbrat2005 Jan 19, 2023
cca1c39
removed local prefix from lng - should come from bgp
mbrat2005 Jan 19, 2023
dd691ab
enable ping spoke 2
mbrat2005 Feb 23, 2023
c6cc571
Merge branch 'master' of https://github.com/microsoft/WhatTheHack int…
mbrat2005 Mar 1, 2023
cfdf132
afw hub route
mbrat2005 Jun 1, 2023
98fbd60
add 172.16.10.0/24 to adv routes
mbrat2005 Jun 2, 2023
baeefbc
correct 172.16.10.0/24 route on csr
mbrat2005 Jun 5, 2023
af616a8
removed route server bicep
mbrat2005 Jun 5, 2023
4f5a504
new-deployment --> new-subscriptiondeployment
mbrat2005 Jul 12, 2023
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
14 changes: 14 additions & 0 deletions 035-HubAndSpoke/Coach/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,17 @@ These topics are not covered, and you might want to introduce them along the way
- Add an Application Gateway to the mix
- Challenge 5: **[PaaS Networking](05-Paas.md)**
- Integrate Azure Web Apps and Azure SQL Databases with your hub and spoke design

## Deployment using Infrastructure-as-Code
The coaches solutions for this hack includes a deployment of the challenges written in Bicep.

For coaches, the infrastructure deployed in the solution can provide a quick reference architecture/lab for an approach to implementing the challenges.

For students, the automation presents a solution, which the students are generally expected to figure out on their own. However, there are a number of scenarios where providing a student with the Bicep files could be helpful:

* Bringing a student up to speed with the rest of the cohort
* Enabling students to focus on the network aspects of the hack, versus manual infrastructure deployment (especially when they are struggling with a less-relevant aspect)
* Quickly bringing a cohort of students up to a specific challenge (for example, enabling data-focused students to work with PaaS services and Private Endpoints, without having had to manually deploy the underlying infrastructure)
* Providing examples to students looking to implement the hack with IaC

**See [Bicep Solution Readme](./Solutions/bicep/README.md) for detail deployment process.**
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
param location string = 'eastus2'

targetScope = 'subscription'
//hub resources
resource wthrghub 'Microsoft.Resources/resourceGroups@2021-04-01' = {
name: 'wth-rg-hub'
location: location
}

resource wthrgspoke01 'Microsoft.Resources/resourceGroups@2021-04-01' = {
name: 'wth-rg-spoke1'
location: location
}

resource wthrgspoke02 'Microsoft.Resources/resourceGroups@2021-04-01' = {
name: 'wth-rg-spoke2'
location: location
}

resource wthrgonprem 'Microsoft.Resources/resourceGroups@2021-04-01' = {
name: 'wth-rg-onprem'
location: location
}
281 changes: 281 additions & 0 deletions 035-HubAndSpoke/Coach/Solutions/bicep/01-01-hub.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,281 @@
param location string = 'eastus2'
param hubVMUsername string = 'admin-wth'
@secure()
param vmPassword string

targetScope = 'resourceGroup'
//hub resources

resource wthhubvnet 'Microsoft.Network/virtualNetworks@2021-08-01' = {
name: 'wth-vnet-hub01'
location: location
properties: {
addressSpace: {
addressPrefixes: [
'10.0.0.0/16'
]
}
subnets: [
{
name: 'GatewaySubnet'
properties: {
addressPrefix: '10.0.0.0/24'
routeTable: {
id: rtvnetgw.id
}
}
}
{
name: 'subnet-hubvms'
properties: {
addressPrefix: '10.0.10.0/24'
routeTable: {
id: rthubvms.id
}
networkSecurityGroup: {
id: nsghubvms.id
}
}
}
{
name: 'AzureFirewallSubnet'
properties: {
addressPrefix: '10.0.1.0/24'
}
}
]
}
}

resource wthhubgwpip01 'Microsoft.Network/publicIPAddresses@2022-01-01' = {
name: 'wth-pip-gw01'
location: location
sku: {
name: 'Standard'
tier: 'Regional'
}
properties: {
publicIPAllocationMethod: 'Static'
}
}

output pipgw1 string = wthhubgwpip01.properties.ipAddress

resource wthhubgwpip02 'Microsoft.Network/publicIPAddresses@2022-01-01' = {
name: 'wth-pip-gw02'
location: location
sku: {
name: 'Standard'
tier: 'Regional'
}
properties: {
publicIPAllocationMethod: 'Static'
}
}

output pipgw2 string = wthhubgwpip02.properties.ipAddress

resource wthhubvnetgw 'Microsoft.Network/virtualNetworkGateways@2022-01-01' = {
name: 'wth-vngw-hub01'
location: location
properties: {
activeActive: true
bgpSettings: {
asn: 65515
}
enableBgp: true
gatewayType: 'Vpn'
vpnType: 'RouteBased'
vpnGatewayGeneration: 'Generation1'
sku: {
name: 'VpnGw1'
tier: 'VpnGw1'
}
ipConfigurations: [
{
name: 'ipconfig1'
properties: {
publicIPAddress: {
id: wthhubgwpip01.id
}
subnet: {
id: '${wthhubvnet.id}/subnets/GatewaySubnet'
}
}
}
{
name: 'ipconfig2'
properties: {
publicIPAddress: {
id: wthhubgwpip02.id
}
subnet: {
id: '${wthhubvnet.id}/subnets/GatewaySubnet'
}
}
}
]
}
}

output wthhubvnetgwasn int = wthhubvnetgw.properties.bgpSettings.asn
output wthhubvnetgwprivateip1 string = wthhubvnetgw.properties.bgpSettings.bgpPeeringAddresses[0].defaultBgpIpAddresses[0]
output wthhubvnetgwprivateip2 string = wthhubvnetgw.properties.bgpSettings.bgpPeeringAddresses[1].defaultBgpIpAddresses[0]

resource changerdpport 'Microsoft.Compute/virtualMachines/extensions@2022-03-01' = {
name: '${wthhubvm01.name}/wth-vmextn-changerdpport33899'
location: location
properties: {
publisher: 'Microsoft.Compute'
type: 'CustomScriptExtension'
typeHandlerVersion: '1.10'
settings: {
/*
To generate encoded command in PowerShell:

$s = @'
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\" -Name PortNumber -Value 33899
New-NetFirewallRule -DisplayName "RDP 33899 TCP" -Direction Inbound -LocalPort 33899 -Protocol TCP -Action Allow
New-NetFirewallRule -DisplayName "RDP 33899 UDP" -Direction Inbound -LocalPort 33899 -Protocol UDP -Action Allow
Restart-Service -Name TermService -Force

New-NetFirewallRule -DisplayName 'ICMPv4' -Direction Inbound -Action Allow -Protocol icmpv4 -Enabled True
'@
$bytes = [System.Text.Encoding]::Unicode.GetBytes($s)
[convert]::ToBase64String($bytes) */
commandToExecute: 'powershell.exe -ep bypass -encodedcommand UwBlAHQALQBJAHQAZQBtAFAAcgBvAHAAZQByAHQAeQAgAC0AUABhAHQAaAAgACIASABLAEwATQA6AFwAUwB5AHMAdABlAG0AXABDAHUAcgByAGUAbgB0AEMAbwBuAHQAcgBvAGwAUwBlAHQAXABDAG8AbgB0AHIAbwBsAFwAVABlAHIAbQBpAG4AYQBsACAAUwBlAHIAdgBlAHIAXABXAGkAbgBTAHQAYQB0AGkAbwBuAHMAXABSAEQAUAAtAFQAYwBwAFwAIgAgAC0ATgBhAG0AZQAgAFAAbwByAHQATgB1AG0AYgBlAHIAIAAtAFYAYQBsAHUAZQAgADMAMwA4ADkAOQANAAoATgBlAHcALQBOAGUAdABGAGkAcgBlAHcAYQBsAGwAUgB1AGwAZQAgAC0ARABpAHMAcABsAGEAeQBOAGEAbQBlACAAIgBSAEQAUAAgADMAMwA4ADkAOQAgAFQAQwBQACIAIAAtAEQAaQByAGUAYwB0AGkAbwBuACAASQBuAGIAbwB1AG4AZAAgAC0ATABvAGMAYQBsAFAAbwByAHQAIAAzADMAOAA5ADkAIAAtAFAAcgBvAHQAbwBjAG8AbAAgAFQAQwBQACAALQBBAGMAdABpAG8AbgAgAEEAbABsAG8AdwANAAoATgBlAHcALQBOAGUAdABGAGkAcgBlAHcAYQBsAGwAUgB1AGwAZQAgAC0ARABpAHMAcABsAGEAeQBOAGEAbQBlACAAIgBSAEQAUAAgADMAMwA4ADkAOQAgAFUARABQACIAIAAtAEQAaQByAGUAYwB0AGkAbwBuACAASQBuAGIAbwB1AG4AZAAgAC0ATABvAGMAYQBsAFAAbwByAHQAIAAzADMAOAA5ADkAIAAtAFAAcgBvAHQAbwBjAG8AbAAgAFUARABQACAALQBBAGMAdABpAG8AbgAgAEEAbABsAG8AdwANAAoAUgBlAHMAdABhAHIAdAAtAFMAZQByAHYAaQBjAGUAIAAtAE4AYQBtAGUAIABUAGUAcgBtAFMAZQByAHYAaQBjAGUAIAAtAEYAbwByAGMAZQANAAoADQAKAE4AZQB3AC0ATgBlAHQARgBpAHIAZQB3AGEAbABsAFIAdQBsAGUAIAAtAEQAaQBzAHAAbABhAHkATgBhAG0AZQAgACcASQBDAE0AUAB2ADQAJwAgAC0ARABpAHIAZQBjAHQAaQBvAG4AIABJAG4AYgBvAHUAbgBkACAALQBBAGMAdABpAG8AbgAgAEEAbABsAG8AdwAgAC0AUAByAG8AdABvAGMAbwBsACAAaQBjAG0AcAB2ADQAIAAtAEUAbgBhAGIAbABlAGQAIABUAHIAdQBlAA=='
}
}
}

resource wthhubvmpip01 'Microsoft.Network/publicIPAddresses@2022-01-01' = {
name: 'wth-pip-hubvm01'
location: location
sku: {
name: 'Standard'
tier: 'Regional'
}
properties: {
publicIPAllocationMethod: 'Static'
}
}

resource wthhubvmnic 'Microsoft.Network/networkInterfaces@2022-01-01' = {
name: 'wth-nic-hubvm01'
location: location
properties: {
ipConfigurations: [
{
name: 'ipconfig1'
properties: {
subnet: {
id: '${wthhubvnet.id}/subnets/subnet-hubvms'
}
privateIPAddress: '10.0.10.4'
publicIPAddress: {
id: wthhubvmpip01.id
}
}
}
]
}
}

resource wthhubvm01 'Microsoft.Compute/virtualMachines@2022-03-01' = {
name: 'wth-vm-hub01'
location: location
properties: {
hardwareProfile: {
vmSize: 'Standard_B2s'
}
storageProfile: {
imageReference: {
publisher: 'MicrosoftWindowsServer'
offer: 'WindowsServer'
sku: '2022-datacenter-azure-edition'
version: 'latest'
}
osDisk: {
osType: 'Windows'
name: 'wth-disk-vmhubos01'
createOption: 'FromImage'
caching: 'ReadWrite'
}
}
osProfile: {
computerName: 'vm-hub01'
adminUsername: hubVMUsername
adminPassword: vmPassword
windowsConfiguration: {
provisionVMAgent: true
enableAutomaticUpdates: true
}
}
networkProfile: {
networkInterfaces: [
{
id: wthhubvmnic.id
}
]
}
diagnosticsProfile: {
bootDiagnostics: {
enabled: true
}
}
licenseType: 'Windows_Server'
}
}

resource rtvnetgw 'Microsoft.Network/routeTables@2022-01-01' = {
name: 'wth-rt-hubgwsubnet'
location: location
properties: {
routes: []
disableBgpRoutePropagation: false
}
}

resource rthubvms 'Microsoft.Network/routeTables@2022-01-01' = {
name: 'wth-rt-hubvmssubnet'
location: location
properties: {
routes: []
disableBgpRoutePropagation: false
}
}

resource nsghubvms 'Microsoft.Network/networkSecurityGroups@2022-01-01' = {
name: 'wth-nsg-hubvmssubnet'
location: location
properties: {
securityRules: [
{
name: 'allow-altrdp-to-vmssubnet-from-any'
properties: {
priority: 1000
access: 'Allow'
direction: 'Inbound'
protocol: 'Tcp'
sourcePortRange: '*'
destinationPortRange: '33899-33899'
sourceAddressPrefix: '*'
destinationAddressPrefix: '10.0.10.0/24'
}
}
{
name: 'allow-altssh-to-vmssubnet-from-any'
properties: {
priority: 1001
access: 'Allow'
direction: 'Inbound'
protocol: 'Tcp'
sourcePortRange: '*'
destinationPortRange: '22222-22222'
sourceAddressPrefix: '*'
destinationAddressPrefix: '10.0.10.0/24'
}
}
]
}
}
Loading