Skip to content

Commit c4b7f7e

Browse files
added synopsis and domain option for VM
1 parent b1f4d8f commit c4b7f7e

7 files changed

+334
-8
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Change log for AzureSite2SiteVPNLab
22

3+
## 1.4.0 - January 17, 2022
4+
5+
- Fixed vyos setup script output; was out putting blank file in step 2
6+
- Added synopsis to each script; provide steps taken and parameters
7+
- Add OStype parameter to simple Azure VM script; allow Windows 10 or Windows Server deployment
8+
- Added domain join capability for VM; domain controller must exist
9+
310
## 1.3.9 - January 13, 2022
411

512
- check vNet for subnets; ensure vNet has required subnets added if vNet is already provisioned

Step 3A. Build Azure Simple S2S.ps1

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
<#
2+
.SYNOPSIS
3+
Sets up Site 2 Site VPN in Azure
4+
5+
.DESCRIPTION
6+
Sets up Site 2 Site VPN in Azure with 1 gateway and subnet (no hub and spoke)
7+
8+
.NOTES
9+
1. Gets new share key
10+
2. Retrieves VyOS external IP
11+
3. Create a resource group
12+
4. Build subnets configurations
13+
5. Create the VNet; bind subnets
14+
6. Attach gateway to vnet
15+
7. Create the local network gateway
16+
8. Create a Public IP address
17+
9. Attaches public IP to gateway
18+
10. Create the Virtual Network Gateway
19+
11. Create the local network gateway
20+
12. Create the VPN connection
21+
13. Build VyOS VPN Configuration
22+
14. Applies VyOS configurations
23+
15. Check VPN connection
24+
#>
25+
126
$ErrorActionPreference = "Stop"
227
#Requires -Modules Az.Accounts,Az.Resources,Az.Network
328
Set-Item Env:\SuppressAzurePowerShellBreakingChangeWarnings "true" | Out-Null
@@ -166,7 +191,7 @@ Else{
166191
}
167192
#endregion
168193

169-
#region 7. make the gateway
194+
#region 7. Attaches public IP to gateway
170195
If( $subnet = Get-AzVirtualNetworkSubnetConfig -Name 'GatewaySubnet' -VirtualNetwork $vNet -ErrorAction SilentlyContinue )
171196
{
172197
Write-host ("Attaching Azure public IP [{0}] to gateway subnet [{1}]..." -f $AzureSimpleConfig.PublicIpName, 'GatewaySubnet') -ForegroundColor White -NoNewline
@@ -186,7 +211,7 @@ Else{
186211
}
187212
#endregion
188213

189-
#region 8. Create the VPN gateway
214+
#region 8. Create the Virtual Network Gateway
190215
#Check to see if public IP is attached to VNG
191216
If( -Not(Get-AzVirtualNetworkGateway -Name $AzureSimpleConfig.VnetGatewayName -ResourceGroupName $AzureSimpleConfig.ResourceGroupName -ErrorAction SilentlyContinue).IpConfigurations.PublicIpAddress.id )
192217
{
@@ -211,7 +236,7 @@ Else{
211236
}
212237
#endregion
213238

214-
#region 9. Create the Virtual Network Gateway
239+
#region 9. Create the Local Network Gateway
215240
If( -Not($Local = Get-AzLocalNetworkGateway -Name $AzureSimpleConfig.LocalGatewayName -ResourceGroupName $AzureSimpleConfig.ResourceGroupName -ErrorAction SilentlyContinue) )
216241
{
217242
Write-host ("Building the local network gateway [{0}]..." -f $AzureSimpleConfig.LocalGatewayName) -ForegroundColor White -NoNewline

Step 3B-1. Build Azure Advanced S2S - Region 1.ps1

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
<#
2+
.SYNOPSIS
3+
Sets up Site 2 Site VPN in Azure in Region 1
4+
5+
.DESCRIPTION
6+
Sets up Site 2 Site VPN in Azure Region 1 using hub and spoke design
7+
8+
.NOTES
9+
1. Gets new share key
10+
2. Retrieves VyOS external IP
11+
3. Create a resource group
12+
3. Create virtual network A (Hub) with gateway
13+
4. Create virtual network B (Spoke)
14+
5. Build Peering between vnets
15+
6. Create a Public IP address
16+
7. attach public ip to gateway
17+
8. Create the VPN gateway
18+
9. Create the local network gateway
19+
10. Create the VPN connection
20+
11. Build VyOS VPN Configuration
21+
12. Applies VyOS configurations
22+
13. Check VPN connection
23+
#>
124
$ErrorActionPreference = "Stop"
225
#Requires -Modules Az.Accounts,Az.Resources,Az.Network
326
Set-Item Env:\SuppressAzurePowerShellBreakingChangeWarnings "true" | Out-Null

Step 3B-2. Build Azure Advanced S2S - Region 2.ps1

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
<#
2+
.SYNOPSIS
3+
Sets up Site 2 Site VPN in Azure in Region 2
4+
5+
.DESCRIPTION
6+
Sets up Site 2 Site VPN in Azure Region 2 using hub and spoke design
7+
8+
.NOTES
9+
1. Gets new share key
10+
2. Retrieves VyOS external IP
11+
3. Create a resource group
12+
3. Create virtual network A (Hub) with gateway
13+
4. Create virtual network B (Spoke)
14+
5. Build Peering between vnets
15+
6. Create a Public IP address
16+
7. attach public ip to gateway
17+
8. Create the VPN gateway
18+
9. Create the local network gateway
19+
10. Create the VPN connection
20+
11. Build VyOS VPN Configuration
21+
12. Applies VyOS configurations
22+
13. Check VPN connection
23+
#>
124
$ErrorActionPreference = "Stop"
225
#Requires -Modules Az.Accounts,Az.Resources,Az.Network
326
Set-Item Env:\SuppressAzurePowerShellBreakingChangeWarnings "true" | Out-Null

Step 3B-3. Connect Azure Advanced S2S Regions.ps1

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
<#
2+
.SYNOPSIS
3+
Connect Azure vnet to Azure vnets
4+
5+
.DESCRIPTION
6+
Connect Azure Region 1 vnet and Region 2 vnet using VPN gateway
7+
8+
.NOTES
9+
1. Get Region 1 gateway
10+
2. Get Region 2 gateway
11+
3. Building site-2-site VPN gateway connection to second Azure tenant gateway
12+
4. Building site-2-site VPN gateway connection to first Azure tenant gateway
13+
#>
114
$ErrorActionPreference = "Stop"
215
#Requires -Modules Az.Accounts,Az.Resources,Az.Network
316
Set-Item Env:\SuppressAzurePowerShellBreakingChangeWarnings "true" | Out-Null

Step 3C. Attach Azure S2S to Existing Network.ps1

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,80 @@
1+
<#
2+
.SYNOPSIS
3+
Sets up Site 2 Site VPN using existing Azure network
4+
5+
.DESCRIPTION
6+
Sets up Site 2 Site VPN using existing Azure network
7+
8+
.NOTES
9+
1. Gets new share key
10+
2. Retrieves VyOS external IP
11+
3. Grab the resource group
12+
3. Find Virtual network
13+
4. Create the VNet
14+
5. Attach gateway to vnet
15+
6. Create the local network gateway
16+
7. Create a Public IP address
17+
8. make the gateway
18+
9. Create the VPN gateway
19+
10. Create the Virtual Network Gateway
20+
11. Create the VPN connection
21+
12. Remove Public IP (optional)
22+
13. Creating a new NSG (optional)
23+
14. Enabled Autoshutdown on VM's (optional)
24+
15. Create the VPN connection
25+
16. Build VyOS VPN Configuration
26+
17. Applies VyOS configurations
27+
18. Check VPN connection
28+
29+
.PARAMETER Prefix
30+
STRING
31+
32+
.PARAMETER ResourceGroup
33+
MANDATORY
34+
35+
.PARAMETER VirtualNetwork
36+
MANDATORY
37+
38+
.PARAMETER DnsIp
39+
MANDATORY
40+
41+
.PARAMETER RemovePublicIps
42+
SWITCH
43+
44+
.PARAMETER AttachNsg
45+
SWITCH
46+
47+
.PARAMETER EnableVMAutoShutdown
48+
SWITCH
49+
50+
.PARAMETER Force
51+
SWITCH
52+
53+
.EXAMPLE
54+
55+
& '.\Step 3C. Attach Azure S2S to Existing Network.ps1' -Prefix 'contoso' -ResourceGroup 'mecmcb-arm-rg' -VirtualNetwork 'contoso-vnet' -DnsIp '10.120.0.1'
56+
57+
RESULT: Build a VPN connection to existing virtual network with prefix of contoso
58+
59+
.EXAMPLE
60+
61+
& '.\Step 3C. Attach Azure S2S to Existing Network.ps1' -Prefix 'contoso' -ResourceGroup 'mecmcb-arm-rg' -VirtualNetwork 'contoso-vnet' -DnsIp '10.120.0.1' -RemovePublicIps -AttachNsg
62+
63+
RESULT: Build a VPN connection to existing network with prefix of contoso while removing all other attached public ip and adds an Network Security Gateway for VMs on vnet
64+
65+
.EXAMPLE
66+
67+
& '.\Step 3C. Attach Azure S2S to Existing Network.ps1' -Prefix 'contoso' -ResourceGroup 'mecmcb-arm-rg' -VirtualNetwork 'contoso-vnet' -DnsIp '10.120.0.1' -EnableVMAutoShutdown
68+
69+
RESULT: Build a VPN connection to existing network with prefix of contoso and enabled autoshutdown for all VM's
70+
71+
.EXAMPLE
72+
73+
& '.\Step 3C. Attach Azure S2S to Existing Network.ps1' -Prefix 'contoso' -ResourceGroup 'mecmcb-arm-rg' -VirtualNetwork 'contoso-vnet' -DnsIp '10.120.0.1' -Force
74+
75+
RESULT: Build a VPN connection to existing network with prefix of contoso and Rebuilds vyos router's VPN settings
76+
#>
77+
[CmdletBinding()]
178
Param(
279
[string]$Prefix,
380

@@ -66,6 +143,7 @@ Param(
66143
$Prefix='contoso'
67144
$ResourceGroup='mecmcb-arm-rg'
68145
$VirtualNetwork='contoso-vnet'
146+
$DnsIp='10.120.0.1'
69147
#>
70148

71149
$ErrorActionPreference = "Stop"

0 commit comments

Comments
 (0)