Skip to content

Commit

Permalink
Fix Bastion subnet and refine VNet setup
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethcarnes committed Feb 18, 2024
1 parent f051395 commit 234a0c1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion bicep/management.bicep
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
param location string
param hubVnetName string
param hubVnetName string = 'hubVnet'
param bastionPublicIpName string = '${hubVnetName}-bastion-pip'

resource bastionPublicIp 'Microsoft.Network/publicIPAddresses@2020-06-01' = {
Expand All @@ -22,6 +22,7 @@ resource bastionHost 'Microsoft.Network/bastionHosts@2020-11-01' = {
name: '${hubVnetName}-bastion-config'
properties: {
subnet: {
// Make sure the subnet reference is correct and points to an existing AzureBastionSubnet in the hubVnet
id: resourceId('Microsoft.Network/virtualNetworks/subnets', hubVnetName, 'AzureBastionSubnet')
}
publicIPAddress: {
Expand Down
10 changes: 9 additions & 1 deletion bicep/vnets.bicep
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
param location string
param hubVnetName string
param hubVnetName string = 'hubVnet'
param hubSubnet1Prefix string = '10.0.1.0/24'
param hubSubnet2Prefix string = '10.0.2.0/24'
param spokeVnetDetails array
param AzureFirewallSubnet string = '10.0.0.0/24'
param AzureFirewallManagementSubnet string = '10.0.3.0/24'
param AzureBastionSubnetPrefix string = '10.0.4.0/27' // Ensure this prefix doesn't overlap with other subnet ranges

resource hubVnet 'Microsoft.Network/virtualNetworks@2021-02-01' = {
name: hubVnetName
Expand Down Expand Up @@ -38,6 +39,13 @@ resource hubVnet 'Microsoft.Network/virtualNetworks@2021-02-01' = {
addressPrefix: hubSubnet2Prefix
}
}
// Define the AzureBastionSubnet required for the Bastion Host
{
name: 'AzureBastionSubnet'
properties: {
addressPrefix: AzureBastionSubnetPrefix
}
}
]
}
}
Expand Down

0 comments on commit 234a0c1

Please sign in to comment.