Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
7f73925
[Modules] Updated Network/Connections to new dependency approach
AlexanderSehr Aug 30, 2022
c4ce2ef
Merge branch 'main' into users/alsehr/1791_Network_Connections
AlexanderSehr Sep 1, 2022
59a6475
Update to latest
AlexanderSehr Sep 1, 2022
a9fb313
Merge branch 'main' into users/alsehr/1791_Network_Connections
AlexanderSehr Sep 2, 2022
c203efd
Update to latest
AlexanderSehr Sep 9, 2022
2027e03
Update to latest
AlexanderSehr Sep 9, 2022
e3bb208
Update to latest
AlexanderSehr Sep 9, 2022
70517e2
Update to latest
AlexanderSehr Sep 9, 2022
472b466
Update modules/Microsoft.Network/connections/.test/vnet2vnet/deploy.t…
AlexanderSehr Sep 19, 2022
c77e68f
Update to latest
AlexanderSehr Sep 19, 2022
67ef8b0
Update modules/Microsoft.Network/connections/.test/vnet2vnet/dependen…
AlexanderSehr Sep 27, 2022
28b0e2a
Update modules/Microsoft.Network/connections/.test/vnet2vnet/dependen…
AlexanderSehr Sep 27, 2022
226fb14
Update modules/Microsoft.Network/connections/.test/vnet2vnet/dependen…
AlexanderSehr Sep 27, 2022
1ba232a
Update modules/Microsoft.Network/connections/.test/vnet2vnet/deploy.t…
AlexanderSehr Sep 27, 2022
c2ca5f8
Update modules/Microsoft.Network/connections/.test/vnet2vnet/dependen…
AlexanderSehr Sep 27, 2022
e50e93b
Update modules/Microsoft.Network/connections/.test/vnet2vnet/deploy.t…
AlexanderSehr Sep 27, 2022
62265cd
Update modules/Microsoft.Network/connections/.test/vnet2vnet/dependen…
AlexanderSehr Sep 27, 2022
6c83461
Update modules/Microsoft.Network/connections/.test/vnet2vnet/dependen…
AlexanderSehr Sep 27, 2022
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
3 changes: 1 addition & 2 deletions .github/workflows/ms.network.connections.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ jobs:
- name: 'Using test file [${{ matrix.moduleTestFilePaths }}]'
uses: ./.github/actions/templates/validateModuleDeployment
with:
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
parameterFilePath: '${{ env.modulePath }}/${{ matrix.moduleTestFilePaths }}'
templateFilePath: '${{ env.modulePath }}/${{ matrix.moduleTestFilePaths }}'
location: '${{ env.location }}'
resourceGroupName: '${{ env.resourceGroupName }}'
subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}'
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
@description('Optional. The location to deploy resources to.')
param location string = resourceGroup().location

@description('Required. The name of the primary Public IP to create.')
param primaryPublicIPName string

@description('Required. The name of the primary VNET to create.')
param primaryVirtualNetworkName string

@description('Required. The name of the primary Virtual Network Gateway to create.')
param primaryVirtualNetworkGatewayName string

@description('Required. The name of the secondary Public IP to create.')
param secondaryPublicIPName string

@description('Required. The name of the secondary VNET to create.')
param secondaryVirtualNetworkName string

@description('Required. The name of the secondary Virtual Network Gateway to create.')
param secondaryVirtualNetworkGatewayName string

resource primaryVirtualNetwork 'Microsoft.Network/virtualNetworks@2022-01-01' = {
name: primaryVirtualNetworkName
location: location
properties: {
addressSpace: {
addressPrefixes: [
'10.0.0.0/24'
]
}
subnets: [
{
name: 'GatewaySubnet'
properties: {
addressPrefix: '10.0.0.0/24'
}
}
]
}
}

resource primaryPublicIP 'Microsoft.Network/publicIPAddresses@2022-01-01' = {
name: primaryPublicIPName
location: location
}

resource primaryVNETGateway 'Microsoft.Network/virtualNetworkGateways@2021-08-01' = {
name: primaryVirtualNetworkGateway
location: location
properties: {
gatewayType: 'Vpn'
ipConfigurations: [
{
name: 'default'
properties: {
privateIPAllocationMethod: 'Dynamic'
subnet: {
id: primaryVirtualNetwork.properties.subnets[0].id
}
publicIPAddress: {
id: primaryPublicIP.id
}
}
}
]
vpnType: 'RouteBased'
vpnGatewayGeneration: 'Generation2'
sku: {
name: 'VpnGw2'
tier: 'VpnGw2'
}
}
}

resource secondaryVirtualNetwork 'Microsoft.Network/virtualNetworks@2022-01-01' = {
name: secondaryVirtualNetworkName
location: location
properties: {
addressSpace: {
addressPrefixes: [
'10.0.1.0/24'
]
}
subnets: [
{
name: 'GatewaySubnet'
properties: {
addressPrefix: '10.0.1.0/24'
}
}
]
}
}

resource secondaryPublicIP 'Microsoft.Network/publicIPAddresses@2022-01-01' = {
name: secondaryPublicIPName
location: location
}

resource secondaryVNETGateway 'Microsoft.Network/virtualNetworkGateways@2021-08-01' = {
name: secondaryVirtualNetworkGateway
location: location
properties: {
gatewayType: 'Vpn'
ipConfigurations: [
{
name: 'default'
properties: {
privateIPAllocationMethod: 'Dynamic'
subnet: {
id: secondaryVirtualNetwork.properties.subnets[0].id
}
publicIPAddress: {
id: secondaryPublicIP.id
}
}
}
]
vpnType: 'RouteBased'
vpnGatewayGeneration: 'Generation2'
sku: {
name: 'VpnGw2'
tier: 'VpnGw2'
}
}
}

@description('The resource ID of the created primary Virtual Network Gateway.')
output primaryVNETGatewayResourceID string = primaryVNETGateway.id

@description('The resource ID of the created secondary Virtual Network Gateway.')
output secondaryVNETGatewayResourceID string = secondaryVNETGateway.id
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
targetScope = 'subscription'

// ========== //
// Parameters //
// ========== //
@description('Optional. The name of the resource group to deploy for testing purposes.')
@maxLength(80)
param resourceGroupName string = 'ms.network.connections-${serviceShort}-rg'

@description('Optional. The location to deploy resources to.')
param location string = deployment().location

@description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints.')
param serviceShort string = 'ncvtv'

@description('Optional. The password to leverage for the login.')
@secure()
param password string = newGuid()

// =========== //
// Deployments //
// =========== //

// General resources
// =================
resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
name: resourceGroupName
location: location
}

module resourceGroupResources 'dependencies.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name, location)}-paramNested'
params: {
primaryPublicIPName: 'dep-<<namePrefix>>-pip-${serviceShort}-1'
primaryVirtualNetworkName: 'dep-<<namePrefix>>-vnet-${serviceShort}-1'
primaryVirtualNetworkGatewayName: 'dep-<<namePrefix>>-vpn-gw-${serviceShort}-1'
secondaryPublicIPName: 'dep-<<namePrefix>>-pip-${serviceShort}-2'
secondaryVirtualNetworkName: 'dep-<<namePrefix>>-vnet-${serviceShort}-2'
secondaryVirtualNetworkGatewayName: 'dep-<<namePrefix>>-vpn-gw-${serviceShort}-2'
}
}

// ============== //
// Test Execution //
// ============== //

module testDeployment '../../deploy.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name)}-test-${serviceShort}'
params: {
name: '<<namePrefix>>${serviceShort}001'
virtualNetworkGateway1: {
id: resourceGroupResources.outputs.primaryVNETGatewayResourceID
}
enableBgp: false
lock: 'CanNotDelete'
virtualNetworkGateway2: {
id: resourceGroupResources.outputs.secondaryVNETGatewayResourceID
}
virtualNetworkGatewayConnectionType: 'Vnet2Vnet'
vpnSharedKey: password
}
}
32 changes: 9 additions & 23 deletions modules/Microsoft.Network/connections/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,28 +321,22 @@ The following module usage examples are retrieved from the content of the files
<summary>via Bicep module</summary>

```bicep
resource kv1 'Microsoft.KeyVault/vaults@2019-09-01' existing = {
name: 'adp-<<namePrefix>>-az-kv-x-001'
scope: resourceGroup('<<subscriptionId>>','validation-rg')
}

module connections './Microsoft.Network/connections/deploy.bicep' = {
name: '${uniqueString(deployment().name)}-Connections'
name: '${uniqueString(deployment().name)}-test-ncvtv'
params: {
// Required parameters
name: '<<namePrefix>>-az-vnetgwc-x-001'
name: '<<namePrefix>>ncvtv001'
virtualNetworkGateway1: {
id: '/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualNetworkGateways/<<namePrefix>>-az-vnet-vpn-gw-p-001'
id: '<id>'
}
// Non-required parameters
enableBgp: false
location: 'eastus'
lock: 'CanNotDelete'
virtualNetworkGateway2: {
id: '/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualNetworkGateways/<<namePrefix>>-az-vnet-vpn-gw-p-002'
id: '<id>'
}
virtualNetworkGatewayConnectionType: 'Vnet2Vnet'
vpnSharedKey: kv1.getSecret('vpnSharedKey')
vpnSharedKey: '<vpnSharedKey>'
}
}
```
Expand All @@ -361,38 +355,30 @@ module connections './Microsoft.Network/connections/deploy.bicep' = {
"parameters": {
// Required parameters
"name": {
"value": "<<namePrefix>>-az-vnetgwc-x-001"
"value": "<<namePrefix>>ncvtv001"
},
"virtualNetworkGateway1": {
"value": {
"id": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualNetworkGateways/<<namePrefix>>-az-vnet-vpn-gw-p-001"
"id": "<id>"
}
},
// Non-required parameters
"enableBgp": {
"value": false
},
"location": {
"value": "eastus"
},
"lock": {
"value": "CanNotDelete"
},
"virtualNetworkGateway2": {
"value": {
"id": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualNetworkGateways/<<namePrefix>>-az-vnet-vpn-gw-p-002"
"id": "<id>"
}
},
"virtualNetworkGatewayConnectionType": {
"value": "Vnet2Vnet"
},
"vpnSharedKey": {
"reference": {
"keyVault": {
"id": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.KeyVault/vaults/adp-<<namePrefix>>-az-kv-x-001"
},
"secretName": "vpnSharedKey"
}
"value": "<vpnSharedKey>"
}
}
}
Expand Down