Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VPN Gateway P2S support #617

Merged
merged 17 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion docs/wiki/DeploymentFlow.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ In addition, the identity that wants to create a Tenant scope deployment must ha

### Service Principal Account

A service principal account is required to automate through Azure DevOps or GitHub Workflows. This can be created through the [Portal](https://learn.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal), [Azure PowerShell](https://learn.microsoft.com/azure/active-directory/develop/howto-authenticate-service-principal-powershell) or [Azure CLI](https://learn.microsoft.com/cli/azure/create-an-azure-service-principal-azure-cli).
A service principal account is required to automate through Azure DevOps or GitHub Workflows. This can be created through the [Portal](https://learn.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal), [Azure PowerShell](https://learn.microsoft.com/azure/active-directory/develop/howto-authenticate-service-principal-powershell) or [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/azure-cli-sp-tutorial-1).

- **Service Principal Name**: any name (i.e. `spn-azure-platform-ops`)
- **RBAC Assignment**
Expand Down
25 changes: 25 additions & 0 deletions infra-as-code/bicep/modules/hubNetworking/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,31 @@ Module deploys the following resources:
>
> See child module, [`privateDnsZones.bicep` docs](https://github.com/Azure/ALZ-Bicep/tree/main/infra-as-code/bicep/modules/privateDnsZones#dns-zones) for more info on how this works

To configure P2S VPN connections edit the vpnClientConfiguration value in the `parVpnGatewayConfig` parameter.

AAD Authentication Example:

```bicep
"vpnClientConfiguration": {
"vpnClientAddressPool": {
"addressPrefixes": [
"172.16.0.0/24"
]
},
"vpnClientProtocols": [
"OpenVPN"
],
"vpnAuthenticationTypes": [
"AAD"
],
"aadTenant": "https://login.microsoftonline.com/{AzureAD TenantID}",
"aadAudience": "41b23e61-6c1e-4545-b367-cd054e0ed4b4",
"aadIssuer": "https://sts.windows.net/{AzureAD TenantID}/"
}
```

Replace the values for `aadTenant`, `aadAudience`, and `aadIssuer` as documented [here](https://learn.microsoft.com/en-us/azure/vpn-gateway/openvpn-azure-ad-tenant#enable-authentication)

## Outputs

The module will generate the following outputs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ Configuration for VPN virtual network gateway to be deployed. If a VPN virtual n
"value": {}
}

- Default value: `@{name=[format('{0}-Vpn-Gateway', parameters('parCompanyPrefix'))]; gatewayType=Vpn; sku=VpnGw1; vpnType=RouteBased; generation=Generation1; enableBgp=False; activeActive=False; enableBgpRouteTranslationForNat=False; enableDnsForwarding=False; bgpPeeringAddress=; bgpsettings=}`
- Default value: `@{name=[format('{0}-Vpn-Gateway', parameters('parCompanyPrefix'))]; gatewayType=Vpn; sku=VpnGw1; vpnType=RouteBased; generation=Generation1; enableBgp=False; activeActive=False; enableBgpRouteTranslationForNat=False; enableDnsForwarding=False; bgpPeeringAddress=; bgpsettings=; vpnClientConfiguration=}`

### parExpressRouteGatewayConfig

Expand Down Expand Up @@ -570,7 +570,8 @@ outHubVirtualNetworkId | string |
"asn": 65515,
"bgpPeeringAddress": "",
"peerWeight": 5
}
},
"vpnClientConfiguration": {}
}
},
"parExpressRouteGatewayConfig": {
Expand Down
12 changes: 12 additions & 0 deletions infra-as-code/bicep/modules/hubNetworking/hubNetworking.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ param parVpnGatewayConfig object = {
bgpPeeringAddress: ''
peerWeight: 5
}
vpnClientConfiguration: {}
}

@sys.description('''Configuration for ExpressRoute virtual network gateway to be deployed. If a ExpressRoute virtual network gateway is not desired an empty object should be used as the input parameter in the parameter file, i.e.
Expand Down Expand Up @@ -593,6 +594,17 @@ resource resGateway 'Microsoft.Network/virtualNetworkGateways@2023-02-01' = [for
name: gateway.sku
tier: gateway.sku
}
vpnClientConfiguration: (gateway.gatewayType == 'VPN') ? {
vpnClientAddressPool: contains(gateway.vpnClientConfiguration, 'vpnClientAddressPool') ? gateway.vpnClientConfiguration.vpnClientAddressPool: ''
vpnClientProtocols: contains(gateway.vpnClientConfiguration, 'vpnClientProtocols') ? gateway.vpnClientConfiguration.vpnClientProtocols: ''
vpnAuthenticationTypes: contains(gateway.vpnClientConfiguration, 'vpnAuthenticationTypes') ? gateway.vpnClientConfiguration.vpnAuthenticationTypes: ''
aadTenant: contains(gateway.vpnClientConfiguration, 'aadTenant') ? gateway.vpnClientConfiguration.aadTenant : ''
aadAudience: contains(gateway.vpnClientConfiguration, 'aadAudience') ? gateway.vpnClientConfiguration.aadAudience : ''
aadIssuer: contains(gateway.vpnClientConfiguration, 'aadIssuer') ? gateway.vpnClientConfiguration.aadIssuer: ''
vpnClientRootCertificates: contains(gateway.vpnClientConfiguration, 'vpnClientRootCertificates') ? gateway.vpnClientConfiguration.vpnClientRootCertificates: ''
radiusServerAddress: contains(gateway.vpnClientConfiguration, 'radiusServerAddress') ? gateway.vpnClientConfiguration.radiusServerAddress: ''
radiusServerSecret: contains(gateway.vpnClientConfiguration, 'radiusServerSecret') ? gateway.vpnClientConfiguration.radiusServerSecret: ''
} : null
ipConfigurations: [
{
id: resHubVnet.id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
"parVpnGatewayConfig": {
"value": {
"name": "alz-Vpn-Gateway",
"gatewayType": "Vpn",
"gatewayType": "VPN",
"sku": "VpnGw1",
"vpnType": "RouteBased",
"generation": "Generation1",
Expand All @@ -201,7 +201,8 @@
"asn": "65515",
"bgpPeeringAddress": "",
"peerWeight": "5"
}
},
"vpnClientConfiguration": {}
}
},
"parExpressRouteGatewayConfig": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@
"asn": "65515",
"bgpPeeringAddress": "",
"peerWeight": "5"
}
},
"vpnClientConfiguration": {}
}
},
"parExpressRouteGatewayConfig": {
Expand Down
Loading