Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
8e9b44a
added Az Policy and RBAC Modules
ahmadabdalla Oct 5, 2021
2cc5129
updated user identity module
ahmadabdalla Oct 5, 2021
dc2f0e0
Merge remote-tracking branch 'upstream/main' into users/ahmadabdalla/…
ahmadabdalla Oct 5, 2021
d18259e
catered for scenario where retryLimit is set to 1
ahmadabdalla Oct 5, 2021
885675a
added (ge) instead of (gt) for catch
ahmadabdalla Oct 5, 2021
513e45a
updated based on comments
ahmadabdalla Oct 5, 2021
64f5d4f
Merge remote-tracking branch 'upstream/main' into users/ahmadabdalla/…
ahmadabdalla Oct 5, 2021
f7af60b
updated lock scope
ahmadabdalla Oct 5, 2021
80b8ef4
updated test error for readme
ahmadabdalla Oct 5, 2021
eefcc6d
Merge remote-tracking branch 'upstream/main' into users/ahmadabdalla/…
ahmadabdalla Oct 5, 2021
155cd44
updated readme
ahmadabdalla Oct 5, 2021
45c5d93
fixed readme
ahmadabdalla Oct 5, 2021
a5fb7da
updated readme with check mark
ahmadabdalla Oct 5, 2021
3cc62ba
updated lock resource
ahmadabdalla Oct 5, 2021
f338e0d
Merge remote-tracking branch 'upstream/main' into users/ahmadabdalla/…
ahmadabdalla Oct 5, 2021
da792b7
Merge branch 'main' into users/ahmadabdalla/policyAndRbac
ahmadabdalla Oct 5, 2021
ef2e595
Merge remote-tracking branch 'upstream/main'
ahmadabdalla Oct 5, 2021
6b3d55c
Merge branch 'main' into users/ahmadabdalla/policyAndRbac
ahmadabdalla Oct 5, 2021
c8e9092
Clean up commit
ahmadabdalla Oct 5, 2021
9b99228
Modified pipelines to point to bicep file instead
ahmadabdalla Oct 5, 2021
b4c8a08
updated read me
ahmadabdalla Oct 6, 2021
9b4f45d
supressed parameter location validation
ahmadabdalla Oct 6, 2021
81b129e
added workaround
ahmadabdalla Oct 6, 2021
24fb130
added readme details
ahmadabdalla Oct 6, 2021
da0faf2
completed RBAC Assignment
ahmadabdalla Oct 6, 2021
ccb3648
remove check for variable name (_)
ahmadabdalla Oct 6, 2021
d19f3e3
updated policy read me
ahmadabdalla Oct 6, 2021
52d6393
updated policy
ahmadabdalla Oct 6, 2021
a371fd9
updated parameters
ahmadabdalla Oct 6, 2021
2dbafbe
updated readme
ahmadabdalla Oct 6, 2021
4d175a8
updated policy length
ahmadabdalla Oct 6, 2021
dda7d66
updated policy definitions pipeline
ahmadabdalla Oct 6, 2021
80f64b1
added exemption and set definition pipelines
ahmadabdalla Oct 6, 2021
b6b4496
Merge pull request #1 from ahmadabdalla/users/ahmadabdalla/policyAndRbac
ahmadabdalla Oct 6, 2021
59c807e
Users/ahmadabdalla/ms authorization (#2)
ahmadabdalla Oct 6, 2021
b307412
Merge remote-tracking branch 'upstream/main'
ahmadabdalla Oct 6, 2021
86d6c2d
Merge remote-tracking branch 'upstream/main'
ahmadabdalla Oct 6, 2021
9ba64cb
Users/ahmadabdalla/ms auth comments (#3)
ahmadabdalla Oct 8, 2021
51ad772
Merge branch 'Azure:main' into main
ahmadabdalla Oct 8, 2021
c69e208
Merge remote-tracking branch 'upstream/main'
ahmadabdalla Oct 9, 2021
8f44d6d
Merge remote-tracking branch 'upstream/main'
ahmadabdalla Oct 10, 2021
442f25b
Merge remote-tracking branch 'upstream/main'
ahmadabdalla Oct 11, 2021
cfd6226
Merge remote-tracking branch 'upstream/main'
ahmadabdalla Oct 11, 2021
e669249
Merge remote-tracking branch 'upstream/main'
ahmadabdalla Oct 11, 2021
10659c3
Merge remote-tracking branch 'upstream/main'
ahmadabdalla Oct 12, 2021
53242e6
added current version of roles to constructs
ahmadabdalla Oct 12, 2021
f84ad1e
Merge remote-tracking branch 'upstream/main'
ahmadabdalla Oct 12, 2021
60153e5
updated parameter files to point to test subscription
ahmadabdalla Oct 12, 2021
353842e
updated based on feedback
ahmadabdalla Oct 13, 2021
3442cf5
Merge remote-tracking branch 'upstream/main'
ahmadabdalla Oct 13, 2021
e3c62c7
updated to test principal ID
ahmadabdalla Oct 13, 2021
5239741
Merge branch 'Azure:main' into main
ahmadabdalla Oct 14, 2021
54905b5
Merge branch 'Azure:main' into main
ahmadabdalla Oct 17, 2021
03373f5
Merge remote-tracking branch 'upstream/main'
ahmadabdalla Oct 17, 2021
e4266d8
Merge branch 'main' of https://github.com/ahmadabdalla/Modules
ahmadabdalla Oct 17, 2021
2613a92
Updated VNET Peering Template
ahmadabdalla Oct 17, 2021
1563519
updated output from testing
ahmadabdalla Oct 17, 2021
2d0ffb7
Updated virtual network peering bicep module
ahmadabdalla Oct 17, 2021
d044253
restored parameters to iacs
ahmadabdalla Oct 17, 2021
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
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
@description('Optional. The Name of Vnet Peering resource. If not provided, default value will be localVnetName-remoteVnetName')
param peeringName string = '${localVnetName}-${last(split(remoteVirtualNetworkId, '/'))}'

@description('Required. The Name of the Virtual Network to add the peering to.')
param localVnetName string

@description('Optional. Optional. The list of remote networks to peering peer with, including the configuration.')
param peeringConfigurations array = []
@description('Required. The Resource ID of the VNet that is this Local VNet is being peered to. Should be in the format of a Resource ID')
param remoteVirtualNetworkId string

@description('Optional. Whether the forwarded traffic from the VMs in the local virtual network will be allowed/disallowed in remote virtual network. Default is true')
param allowForwardedTraffic bool = true

@description('Optional. If gateway links can be used in remote virtual networking to link to this virtual network. Default is false')
param allowGatewayTransit bool = false

@description('Optional. Whether the VMs in the local virtual network space would be able to access the VMs in remote virtual network space. Default is true')
param allowVirtualNetworkAccess bool = true

@description('Optional. If we need to verify the provisioning state of the remote gateway. Default is true')
param doNotVerifyRemoteGateways bool = true

@description('Optional. If remote gateways can be used on this virtual network. If the flag is set to true, and allowGatewayTransit on remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. Default is false')
param useRemoteGateways bool = false

@description('Optional. Customer Usage Attribution id (GUID). This GUID must be previously registered')
param cuaId string = ''
Expand All @@ -12,19 +30,20 @@ module pid_cuaId './.bicep/nested_cuaId.bicep' = if (!empty(cuaId)) {
params: {}
}

resource virtualNetworkPeering 'Microsoft.Network/virtualNetworks/virtualNetworkPeerings@2020-05-01' = [for peeringConfiguration in peeringConfigurations: {
name: contains(peeringConfiguration, 'peeringName') ? '${localVnetName}/${peeringConfiguration.peeringName}' : '${localVnetName}/${localVnetName}-${last(split(peeringConfiguration.remoteVirtualNetworkId, '/'))}'
resource virtualNetworkPeering 'Microsoft.Network/virtualNetworks/virtualNetworkPeerings@2021-02-01' = {
name: '${localVnetName}/${peeringName}'
properties: {
allowVirtualNetworkAccess: contains(peeringConfiguration, 'allowVirtualNetworkAccess') ? peeringConfiguration.allowVirtualNetworkAccess : true
allowForwardedTraffic: contains(peeringConfiguration, 'allowForwardedTraffic') ? peeringConfiguration.allowForwardedTraffic : true
allowGatewayTransit: contains(peeringConfiguration, 'allowGatewayTransit') ? peeringConfiguration.allowGatewayTransit : false
useRemoteGateways: contains(peeringConfiguration, 'useRemoteGateways') ? peeringConfiguration.useRemoteGateways : true
allowForwardedTraffic: allowForwardedTraffic
allowGatewayTransit: allowGatewayTransit
allowVirtualNetworkAccess: allowVirtualNetworkAccess
doNotVerifyRemoteGateways: doNotVerifyRemoteGateways
useRemoteGateways: useRemoteGateways
remoteVirtualNetwork: {
id: peeringConfiguration.remoteVirtualNetworkId
id: remoteVirtualNetworkId
}
}
}]
}

output virtualNetworkPeeringResourceGroup string = resourceGroup().name
output virtualNetworkPeeringNames array = [for i in range(0, length(peeringConfigurations)): virtualNetworkPeering[i].name]
output localVirtualNetworkPeeringResourceIds array = [for peeringConfiguration in peeringConfigurations: resourceId('Microsoft.Network/virtualNetworks/virtualNetworkPeerings', localVnetName, (contains(peeringConfiguration, 'peeringName') ? peeringConfiguration.peeringName : '${localVnetName}-${last(split(peeringConfiguration.remoteVirtualNetworkId, '/'))}')) ]
output virtualNetworkPeeringName string = virtualNetworkPeering.name
output virtualNetworkPeeringResourceId string = virtualNetworkPeering.id
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@
"contentVersion": "1.0.0.0",
"parameters": {
"localVnetName": {
"value": "sxx-az-vnet-weu-x-004"
"value": "sxx-az-vnet-weu-x-002"
},
"peeringConfigurations": {
"value": [
{
"peeringName": "sxx-az-peering-weu-x-002-sxx-az-peering-weu-x-003",
"remoteVirtualNetworkId": "/subscriptions/8629be3b-96bc-482d-a04b-ffff597c65a2/resourceGroups/dependencies-rg/providers/Microsoft.Network/virtualNetworks/sxx-az-vnet-weu-x-003",
"useRemoteGateways": false
},
{
"remoteVirtualNetworkId": "/subscriptions/8629be3b-96bc-482d-a04b-ffff597c65a2/resourceGroups/dependencies-rg/providers/Microsoft.Network/virtualNetworks/peeringNetwork",
"useRemoteGateways": false
}
]
"remoteVirtualNetworkId": {
"value": "/subscriptions/8629be3b-96bc-482d-a04b-ffff597c65a2/resourceGroups/dependencies-rg/providers/Microsoft.Network/virtualNetworks/sxx-az-vnet-weu-x-003"
},
"allowForwardedTraffic": {
"value": true
},
"allowGatewayTransit": {
"value": false
},
"allowVirtualNetworkAccess": {
"value": true
},
"useRemoteGateways": {
"value": false
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,59 +4,46 @@ This template deploys Virtual Network Peering.

## Resource types

| Resource Type | Api Version |
| :-- | :-- |
| `Microsoft.Network/virtualNetworks/virtualNetworkPeerings` | 2020-05-01 |
| `Microsoft.Resources/deployments` | 2019-10-01 |
| Resource Type | Api Version |
| :--------------------------------------------------------- | :---------- |
| `Microsoft.Network/virtualNetworks/virtualNetworkPeerings` | 2021-02-01 |
| `Microsoft.Resources/deployments` | 2019-10-01 |

### Resource dependency

The following resources are required to be able to deploy this resource.
The following resources are required to be able to deploy this resource.

- *None*
- Local Virtual Network (Identified by the `localVnetName` parameter).
- Remote Virtual Network (Identified by the `remoteVirtualNetworkId` parameter)

## Parameters

| Parameter Name | Type | Description | DefaultValue | Possible values |
| :-- | :-- | :-- | :-- | :-- |
| `cuaId` | string | Optional. Customer Usage Attribution id (GUID). This GUID must be previously registered | | |
| `localVnetName` | string | Required. The Name of the Virtual Network to add the peering to. | | |
| `peeringConfigurations` | array | Optional. The list of remote networks to peering peer with, including the configuration. See below for instructions. | System.Object[] | |

### Parameter Usage: `peeringConfigurations`

Array containing multiple objects for different VNETs to peer with.

```json
"peeringConfigurations": {
"value": [
{
"peeringName": "sxx-az-peering-weu-x-002-sxx-az-peering-weu-x-003", // Optional
"remoteVirtualNetworkId": "/subscriptions/<subscriptionId>/resourceGroups/dependencies-rg/providers/Microsoft.Network/virtualNetworks/<vnetName>",
"allowVirtualNetworkAccess": false, // Optional. Default true
"allowForwardedTraffic": false, // Optional. Default true
"allowGatewayTransit": false, // Optional. Default false
"useRemoteGateways": false // Optional. Default true
}
]
}
```
| Parameter Name | Type | Description | DefaultValue | Possible values |
| :-------------------------- | :----- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------- | :-------------- |
| `peeringName` | string | Optional. The Name of Vnet Peering resource. If not provided, default value will be localVnetName-remoteVnetName | localVnetName-remoteVnetName | |
| `localVnetName` | string | Required. The Name of the Virtual Network to add the peering to. | | |
| `remoteVirtualNetworkId` | string | Required. The Resource ID of the VNet that is this Local VNet is being peered to. Should be in the format of a Resource ID. | | |
| `allowForwardedTraffic` | bool | Optional. Whether the forwarded traffic from the VMs in the local virtual network will be allowed/disallowed in remote virtual network. Default is true. | `true` | |
| `allowGatewayTransit` | bool | Optional. If gateway links can be used in remote virtual networking to link to this virtual network. Default is false. | `false` | |
| `allowVirtualNetworkAccess` | bool | Optional. Whether the VMs in the local virtual network space would be able to access the VMs in remote virtual network space. Default is true. | `true` | |
| `doNotVerifyRemoteGateways` | bool | Optional. If we need to verify the provisioning state of the remote gateway. Default is true'. | `true` | |
| `useRemoteGateways` | bool | Optional. If remote gateways can be used on this virtual network. If the flag is set to true, and allowGatewayTransit on remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. Default is false | `false` | |
| `cuaId` | string | Optional. Customer Usage Attribution id (GUID). This GUID must be previously registered | | |

## Outputs

| Output Name | Type | Description |
| :-- | :-- | :-- |
| `localVirtualNetworkPeeringResourceIds` | array | |
| `virtualNetworkPeeringNames` | array | |
| `virtualNetworkPeeringResourceGroup` | string | |
| Output Name | Type | Description |
| :----------------------------------- | :----- | :-------------------------------------------------------------------- |
| `virtualNetworkPeeringResourceId` | array | The Resource ID of the Local VNet Peering created in this deployment. |
| `virtualNetworkPeeringName` | array | The name of the VNet Peering resource . |
| `virtualNetworkPeeringResourceGroup` | string | The Resource Group name of the local VNet Peering resource/. |

## Considerations

- *None*

## Additional resources

- [Use tags to organize your Azure resources](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-using-tags)
- [Azure Resource Manager template reference](https://docs.microsoft.com/en-us/azure/templates/)
- [VirtualNetworks/VirtualNetworkPeerings](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Network/2020-05-01/virtualNetworks/virtualNetworkPeerings)
- [Deployments](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Resources/2019-10-01/deployments)
- [Deployments](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Resources/2019-10-01/deployments)
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@description('Required. The Name of the Virtual Network to add the peering to.')
param localVnetName string

@description('Optional. Optional. The list of remote networks to peering peer with, including the configuration.')
param peeringConfigurations array = []

@description('Optional. Customer Usage Attribution id (GUID). This GUID must be previously registered')
param cuaId string = ''

module pid_cuaId './.bicep/nested_cuaId.bicep' = if (!empty(cuaId)) {
name: 'pid-${cuaId}'
params: {}
}

resource virtualNetworkPeering 'Microsoft.Network/virtualNetworks/virtualNetworkPeerings@2020-05-01' = [for peeringConfiguration in peeringConfigurations: {
name: contains(peeringConfiguration, 'peeringName') ? '${localVnetName}/${peeringConfiguration.peeringName}' : '${localVnetName}/${localVnetName}-${last(split(peeringConfiguration.remoteVirtualNetworkId, '/'))}'
properties: {
allowVirtualNetworkAccess: contains(peeringConfiguration, 'allowVirtualNetworkAccess') ? peeringConfiguration.allowVirtualNetworkAccess : true
allowForwardedTraffic: contains(peeringConfiguration, 'allowForwardedTraffic') ? peeringConfiguration.allowForwardedTraffic : true
allowGatewayTransit: contains(peeringConfiguration, 'allowGatewayTransit') ? peeringConfiguration.allowGatewayTransit : false
useRemoteGateways: contains(peeringConfiguration, 'useRemoteGateways') ? peeringConfiguration.useRemoteGateways : true
remoteVirtualNetwork: {
id: peeringConfiguration.remoteVirtualNetworkId
}
}
}]

output virtualNetworkPeeringResourceGroup string = resourceGroup().name
output virtualNetworkPeeringNames array = [for i in range(0, length(peeringConfigurations)): virtualNetworkPeering[i].name]
output localVirtualNetworkPeeringResourceIds array = [for peeringConfiguration in peeringConfigurations: resourceId('Microsoft.Network/virtualNetworks/virtualNetworkPeerings', localVnetName, (contains(peeringConfiguration, 'peeringName') ? peeringConfiguration.peeringName : '${localVnetName}-${last(split(peeringConfiguration.remoteVirtualNetworkId, '/'))}')) ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"localVnetName": {
"value": "sxx-az-vnet-weu-x-004"
},
"peeringConfigurations": {
"value": [
{
"peeringName": "sxx-az-peering-weu-x-002-sxx-az-peering-weu-x-003",
"remoteVirtualNetworkId": "/subscriptions/8629be3b-96bc-482d-a04b-ffff597c65a2/resourceGroups/dependencies-rg/providers/Microsoft.Network/virtualNetworks/sxx-az-vnet-weu-x-003",
"useRemoteGateways": false
},
{
"remoteVirtualNetworkId": "/subscriptions/8629be3b-96bc-482d-a04b-ffff597c65a2/resourceGroups/dependencies-rg/providers/Microsoft.Network/virtualNetworks/peeringNetwork",
"useRemoteGateways": false
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# VirtualNetworkPeering

This template deploys Virtual Network Peering.

## Resource types

| Resource Type | Api Version |
| :-- | :-- |
| `Microsoft.Network/virtualNetworks/virtualNetworkPeerings` | 2020-05-01 |
| `Microsoft.Resources/deployments` | 2019-10-01 |

### Resource dependency

The following resources are required to be able to deploy this resource.

- *None*

## Parameters

| Parameter Name | Type | Description | DefaultValue | Possible values |
| :-- | :-- | :-- | :-- | :-- |
| `cuaId` | string | Optional. Customer Usage Attribution id (GUID). This GUID must be previously registered | | |
| `localVnetName` | string | Required. The Name of the Virtual Network to add the peering to. | | |
| `peeringConfigurations` | array | Optional. The list of remote networks to peering peer with, including the configuration. See below for instructions. | System.Object[] | |

### Parameter Usage: `peeringConfigurations`

Array containing multiple objects for different VNETs to peer with.

```json
"peeringConfigurations": {
"value": [
{
"peeringName": "sxx-az-peering-weu-x-002-sxx-az-peering-weu-x-003", // Optional
"remoteVirtualNetworkId": "/subscriptions/<subscriptionId>/resourceGroups/dependencies-rg/providers/Microsoft.Network/virtualNetworks/<vnetName>",
"allowVirtualNetworkAccess": false, // Optional. Default true
"allowForwardedTraffic": false, // Optional. Default true
"allowGatewayTransit": false, // Optional. Default false
"useRemoteGateways": false // Optional. Default true
}
]
}
```

## Outputs

| Output Name | Type | Description |
| :-- | :-- | :-- |
| `localVirtualNetworkPeeringResourceIds` | array | |
| `virtualNetworkPeeringNames` | array | |
| `virtualNetworkPeeringResourceGroup` | string | |

## Considerations

- *None*

## Additional resources

- [Use tags to organize your Azure resources](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-using-tags)
- [Azure Resource Manager template reference](https://docs.microsoft.com/en-us/azure/templates/)
- [VirtualNetworks/VirtualNetworkPeerings](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Network/2020-05-01/virtualNetworks/virtualNetworkPeerings)
- [Deployments](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Resources/2019-10-01/deployments)