This commit is contained in:
Srđan Božović
2018-08-24 03:56:01 +02:00
parent 1375b202c3
commit 1d366f2c00
2 changed files with 20 additions and 23 deletions
@@ -81,6 +81,22 @@ function Load-ResourceGroup {
}
}
function Set-VirtualNetwork
{
param($virtualNetwork)
Write-Host "Applying changes to the virtual network."
Try
{
Set-AzureRmVirtualNetwork -VirtualNetwork $virtualNetwork -ErrorAction Stop | Out-Null
}
Catch
{
Write-Host "Failed: $_" -ForegroundColor Red
}
}
function ConvertCidrToUint32Array
{
param($cidrRange)
@@ -166,6 +182,9 @@ $gatewaySubnetPrefix = CalculateNextAddressPrefix $virtualNetwork 28
$vpnClientAddressPoolPrefix = CalculateVpnClientAddressPoolPrefix $gatewaySubnetPrefix
$virtualNetwork.AddressSpace.AddressPrefixes.Add($gatewaySubnetPrefix)
Add-AzureRmVirtualNetworkSubnetConfig -Name GatewaySubnet -VirtualNetwork $virtualNetwork -AddressPrefix $gatewaySubnetPrefix | Out-Null
Write-Host
# Start the deployment
@@ -42,27 +42,6 @@
"clientRootCertName": "RootCert"
},
"resources": [
{
"name": "[parameters('virtualNetworkName')]",
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2018-02-01",
"location": "[parameters('location')]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"[parameters('gatewaySubnetPrefix')]"
]
},
"subnets": [
{
"name": "[variables('gatewaySubnetName')]",
"properties": {
"addressPrefix": "[parameters('gatewaySubnetPrefix')]"
}
}
]
}
},
{
"apiVersion": "2017-10-01",
"type": "Microsoft.Network/publicIPAddresses",
@@ -78,8 +57,7 @@
"name": "[variables('gatewayName')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('gatewayPublicIpAddressName'))]",
"[concat('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]"
"[concat('Microsoft.Network/publicIPAddresses/', variables('gatewayPublicIpAddressName'))]"
],
"properties": {
"ipConfigurations": [