Skip to content

Commit

Permalink
Merge branch 'Azure:main' into avm-resiliency-vnetGw
Browse files Browse the repository at this point in the history
  • Loading branch information
sebassem authored Sep 26, 2024
2 parents 05277af + 0324570 commit 85b308a
Show file tree
Hide file tree
Showing 26 changed files with 2,141 additions and 324 deletions.
18 changes: 10 additions & 8 deletions avm/ptn/ai-platform/baseline/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,28 @@ By integrating with Microsoft Entra ID for secure identity management and utiliz
| `Microsoft.Network/privateDnsZones/SRV` | [2020-06-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Network/2020-06-01/privateDnsZones/SRV) |
| `Microsoft.Network/privateDnsZones/TXT` | [2020-06-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Network/2020-06-01/privateDnsZones/TXT) |
| `Microsoft.Network/privateDnsZones/virtualNetworkLinks` | [2020-06-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Network/2020-06-01/privateDnsZones/virtualNetworkLinks) |
| `Microsoft.Network/privateEndpoints` | [2023-11-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Network/2023-11-01/privateEndpoints) |
| `Microsoft.Network/privateEndpoints` | [2023-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Network/2023-04-01/privateEndpoints) |
| `Microsoft.Network/privateEndpoints/privateDnsZoneGroups` | [2023-11-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Network/2023-11-01/privateEndpoints/privateDnsZoneGroups) |
| `Microsoft.Network/privateEndpoints` | [2023-11-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Network/2023-11-01/privateEndpoints) |
| `Microsoft.Network/privateEndpoints/privateDnsZoneGroups` | [2023-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Network/2023-04-01/privateEndpoints/privateDnsZoneGroups) |
| `Microsoft.Network/privateEndpoints/privateDnsZoneGroups` | [2023-11-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Network/2023-11-01/privateEndpoints/privateDnsZoneGroups) |
| `Microsoft.Network/publicIPAddresses` | [2023-09-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Network/2023-09-01/publicIPAddresses) |
| `Microsoft.Network/virtualNetworks` | [2024-01-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Network/virtualNetworks) |
| `Microsoft.Network/virtualNetworks/subnets` | [2024-01-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Network/virtualNetworks/subnets) |
| `Microsoft.Network/virtualNetworks/virtualNetworkPeerings` | [2024-01-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Network/virtualNetworks/virtualNetworkPeerings) |
| `Microsoft.OperationalInsights/workspaces` | [2023-09-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.OperationalInsights/2023-09-01/workspaces) |
| `Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems` | [2023-01-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.RecoveryServices/2023-01-01/vaults/backupFabrics/protectionContainers/protectedItems) |
| `Microsoft.Storage/storageAccounts` | [2022-09-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Storage/2022-09-01/storageAccounts) |
| `Microsoft.Storage/storageAccounts/blobServices` | [2022-09-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Storage/2022-09-01/storageAccounts/blobServices) |
| `Microsoft.Storage/storageAccounts/blobServices/containers` | [2022-09-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Storage/2022-09-01/storageAccounts/blobServices/containers) |
| `Microsoft.Storage/storageAccounts/blobServices/containers/immutabilityPolicies` | [2022-09-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Storage/2022-09-01/storageAccounts/blobServices/containers/immutabilityPolicies) |
| `Microsoft.Storage/storageAccounts/fileServices` | [2023-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Storage/storageAccounts/fileServices) |
| `Microsoft.Storage/storageAccounts/fileServices` | [2023-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Storage/2023-04-01/storageAccounts/fileServices) |
| `Microsoft.Storage/storageAccounts/fileServices/shares` | [2023-01-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Storage/2023-01-01/storageAccounts/fileServices/shares) |
| `Microsoft.Storage/storageAccounts/localUsers` | [2023-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Storage/storageAccounts/localUsers) |
| `Microsoft.Storage/storageAccounts/localUsers` | [2023-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Storage/2023-04-01/storageAccounts/localUsers) |
| `Microsoft.Storage/storageAccounts/managementPolicies` | [2023-01-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Storage/2023-01-01/storageAccounts/managementPolicies) |
| `Microsoft.Storage/storageAccounts/queueServices` | [2023-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Storage/storageAccounts/queueServices) |
| `Microsoft.Storage/storageAccounts/queueServices/queues` | [2023-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Storage/storageAccounts/queueServices/queues) |
| `Microsoft.Storage/storageAccounts/tableServices` | [2023-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Storage/storageAccounts/tableServices) |
| `Microsoft.Storage/storageAccounts/tableServices/tables` | [2023-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Storage/storageAccounts/tableServices/tables) |
| `Microsoft.Storage/storageAccounts/queueServices` | [2023-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Storage/2023-04-01/storageAccounts/queueServices) |
| `Microsoft.Storage/storageAccounts/queueServices/queues` | [2023-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Storage/2023-04-01/storageAccounts/queueServices/queues) |
| `Microsoft.Storage/storageAccounts/tableServices` | [2023-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Storage/2023-04-01/storageAccounts/tableServices) |
| `Microsoft.Storage/storageAccounts/tableServices/tables` | [2023-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Storage/2023-04-01/storageAccounts/tableServices/tables) |

## Usage examples

Expand Down Expand Up @@ -1150,6 +1151,7 @@ This section gives you an overview of all local-referenced module files (i.e., o
| `br/public:avm/res/network/bastion-host:0.2.2` | Remote reference |
| `br/public:avm/res/network/network-security-group:0.3.1` | Remote reference |
| `br/public:avm/res/network/private-dns-zone:0.3.1` | Remote reference |
| `br/public:avm/res/network/virtual-network:0.4.0` | Remote reference |
| `br/public:avm/res/storage/storage-account:0.11.0` | Remote reference |

## Data Collection
Expand Down
88 changes: 39 additions & 49 deletions avm/ptn/ai-platform/baseline/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ var createVirtualMachine = createVirtualNetwork && virtualMachineConfiguration.?

var createDefaultNsg = virtualNetworkConfiguration.?subnet.networkSecurityGroupResourceId == null

var subnetResourceId = createVirtualNetwork ? virtualNetwork::defaultSubnet.id : null
var subnetResourceId = createVirtualNetwork ? virtualNetwork.outputs.subnetResourceIds[0] : null

var mlTargetSubResource = 'amlworkspace'

Expand Down Expand Up @@ -103,7 +103,7 @@ module storageAccount_privateDnsZones 'br/public:avm/res/network/private-dns-zon
name: zone
virtualNetworkLinks: [
{
virtualNetworkResourceId: virtualNetwork.id
virtualNetworkResourceId: virtualNetwork.outputs.resourceId
}
]
}
Expand All @@ -117,7 +117,7 @@ module workspaceHub_privateDnsZones 'br/public:avm/res/network/private-dns-zone:
name: zone
virtualNetworkLinks: [
{
virtualNetworkResourceId: virtualNetwork.id
virtualNetworkResourceId: virtualNetwork.outputs.resourceId
}
]
roleAssignments: managedIdentityName != null
Expand Down Expand Up @@ -160,47 +160,37 @@ module defaultNetworkSecurityGroup 'br/public:avm/res/network/network-security-g
}
}

// Not using the br/public:avm/res/network/virtual-network module here to
// allow consumers of the module to add subnets from outside of the module
// https://github.com/Azure/bicep-registry-modules/issues/2689
resource virtualNetwork 'Microsoft.Network/virtualNetworks@2024-01-01' = if (createVirtualNetwork) {
name: virtualNetworkConfiguration.?name ?? 'vnet-${name}'
location: location
tags: tags
properties: {
addressSpace: {
addressPrefixes: [
virtualNetworkConfiguration.?addressPrefix ?? '10.0.0.0/16'
]
}
}

resource defaultSubnet 'subnets@2024-01-01' = {
name: virtualNetworkConfiguration.?subnet.name ?? 'default'
properties: {
addressPrefix: virtualNetworkConfiguration.?subnet.addressPrefix ?? '10.0.0.0/24'
networkSecurityGroup: {
id: createDefaultNsg
? defaultNetworkSecurityGroup.outputs.resourceId
: virtualNetworkConfiguration.?subnet.networkSecurityGroupResourceId
}
}
}

resource bastionSubnet 'subnets@2024-01-01' = if (createBastion) {
name: 'AzureBastionSubnet'
properties: {
addressPrefix: bastionConfiguration.?subnetAddressPrefix ?? '10.0.1.0/26'
networkSecurityGroup: bastionConfiguration.?networkSecurityGroupResourceId != null
? {
id: bastionConfiguration.?networkSecurityGroupResourceId
}
: null
}

dependsOn: [
defaultSubnet
module virtualNetwork 'br/public:avm/res/network/virtual-network:0.4.0' = if (createVirtualNetwork) {
name: '${uniqueString(deployment().name, location)}-virtual-network'
params: {
name: virtualNetworkConfiguration.?name ?? 'vnet-${name}'
location: location
enableTelemetry: enableTelemetry
addressPrefixes: [
virtualNetworkConfiguration.?addressPrefix ?? '10.0.0.0/16'
]
subnets: union(
// The default subnet **must** be the first in the subnets array
[
{
addressPrefix: virtualNetworkConfiguration.?subnet.addressPrefix ?? '10.0.0.0/24'
name: virtualNetworkConfiguration.?subnet.name ?? 'default'
networkSecurityGroupResourceId: createDefaultNsg
? defaultNetworkSecurityGroup.outputs.resourceId
: virtualNetworkConfiguration.?subnet.networkSecurityGroupResourceId
}
],
createBastion
? [
{
addressPrefix: bastionConfiguration.?subnetAddressPrefix ?? '10.0.1.0/26'
name: 'AzureBastionSubnet'
networkSecurityGroupResourceId: bastionConfiguration.?networkSecurityGroupResourceId
}
]
: []
)
tags: tags
}
}

Expand All @@ -211,7 +201,7 @@ module bastion 'br/public:avm/res/network/bastion-host:0.2.2' = if (createBastio
location: location
skuName: bastionConfiguration.?sku ?? 'Standard'
enableTelemetry: enableTelemetry
virtualNetworkResourceId: virtualNetwork.id
virtualNetworkResourceId: virtualNetwork.outputs.resourceId
disableCopyPaste: bastionConfiguration.?disableCopyPaste
enableFileCopy: bastionConfiguration.?enableFileCopy
enableIpConnect: bastionConfiguration.?enableIpConnect
Expand Down Expand Up @@ -240,7 +230,7 @@ module virtualMachine 'br/public:avm/res/compute/virtual-machine:0.5.3' = if (cr
{
name: virtualMachineConfiguration.?nicConfigurationConfiguration.ipConfigName ?? 'nic-vm-${name}-ipconfig'
privateIPAllocationMethod: virtualMachineConfiguration.?nicConfigurationConfiguration.privateIPAllocationMethod ?? 'Dynamic'
subnetResourceId: virtualNetwork::defaultSubnet.id
subnetResourceId: virtualNetwork.outputs.subnetResourceIds[0]
}
]
}
Expand Down Expand Up @@ -600,16 +590,16 @@ output workspaceProjectResourceId string = workspaceProject.outputs.resourceId
output workspaceProjectName string = workspaceProject.outputs.name

@description('The resource ID of the virtual network.')
output virtualNetworkResourceId string = createVirtualNetwork ? virtualNetwork.id : ''
output virtualNetworkResourceId string = createVirtualNetwork ? virtualNetwork.outputs.resourceId : ''

@description('The name of the virtual network.')
output virtualNetworkName string = createVirtualNetwork ? virtualNetwork.name : ''
output virtualNetworkName string = createVirtualNetwork ? virtualNetwork.outputs.name : ''

@description('The resource ID of the subnet in the virtual network.')
output virtualNetworkSubnetResourceId string = createVirtualNetwork ? virtualNetwork::defaultSubnet.id : ''
output virtualNetworkSubnetResourceId string = createVirtualNetwork ? virtualNetwork.outputs.subnetResourceIds[0] : ''

@description('The name of the subnet in the virtual network.')
output virtualNetworkSubnetName string = createVirtualNetwork ? virtualNetwork::defaultSubnet.name : ''
output virtualNetworkSubnetName string = createVirtualNetwork ? virtualNetwork.outputs.subnetNames[0] : ''

@description('The resource ID of the Azure Bastion host.')
output bastionResourceId string = createBastion ? bastion.outputs.resourceId : ''
Expand Down
Loading

0 comments on commit 85b308a

Please sign in to comment.