Skip to content

Commit 4fb42bb

Browse files
authored
fix(infrastructure): use correct networking for servicebus (#1320)
<!--- Provide a general summary of your changes in the Title above --> ## Description <!--- Describe your changes in detail --> Service bus resolved the network in the same way as for Redis, so refactoring to do the same. Creating a new dnszone with the proper naming + a dnsgroup ## Related Issue(s) - #{issue number} ## Verification - [ ] **Your** code builds clean without any errors or warnings - [ ] Manual testing done (required) - [ ] Relevant automated test added (if you find this hard, leave it and we'll help out) ## Documentation - [ ] Documentation is updated (either in `docs`-directory, Altinnpedia or a separate linked PR in [altinn-studio-docs.](https://github.com/Altinn/altinn-studio-docs), if applicable) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a private endpoint for enhanced secure connectivity to the Service Bus namespace. - Added a new module for managing a private DNS zone group. - **Improvements** - Updated DNS zone configurations for better resolution and security. - Enhanced naming conventions for resources to ensure compliance with character limits. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 49948b2 commit 4fb42bb

File tree

1 file changed

+25
-29
lines changed

1 file changed

+25
-29
lines changed

.azure/modules/serviceBus/main.bicep

+25-29
Original file line numberDiff line numberDiff line change
@@ -45,55 +45,51 @@ resource serviceBusNamespace 'Microsoft.ServiceBus/namespaces@2023-01-01-preview
4545
tags: tags
4646
}
4747

48-
resource privateEndpoint 'Microsoft.Network/privateEndpoints@2023-11-01' = {
49-
name: '${serviceBusName}-pe'
48+
// private endpoint name max characters is 80
49+
var serviceBusPrivateEndpointName = uniqueResourceName('${namePrefix}-service-bus-pe', 80)
50+
51+
resource serviceBusPrivateEndpoint 'Microsoft.Network/privateEndpoints@2023-11-01' = {
52+
name: serviceBusPrivateEndpointName
5053
location: location
5154
properties: {
52-
subnet: {
53-
id: subnetId
54-
}
55-
ipConfigurations: [
56-
{
57-
name: 'default'
58-
properties: {
59-
groupId: 'namespace'
60-
memberName: 'namespace'
61-
// must be in the range of the subnet
62-
privateIPAddress: '10.0.4.4'
63-
}
64-
}
65-
]
6655
privateLinkServiceConnections: [
6756
{
68-
name: '${namePrefix}-plsc'
57+
name: serviceBusPrivateEndpointName
6958
properties: {
7059
privateLinkServiceId: serviceBusNamespace.id
7160
groupIds: [
7261
'namespace'
7362
]
74-
requestMessage: 'Connection to the Service Bus namespace ${serviceBusName} for Dialogporten'
7563
}
7664
}
7765
]
66+
customNetworkInterfaceName: uniqueResourceName('${namePrefix}-service-bus-pe-nic', 80)
67+
subnet: {
68+
id: subnetId
69+
}
7870
}
7971
tags: tags
8072
}
8173

82-
var serviceBusDomainName = '${serviceBusName}.servicebus.windows.net'
83-
8474
module privateDnsZone '../privateDnsZone/main.bicep' = {
85-
name: 'serviceBusPrivateDnsZone'
75+
name: '${namePrefix}-service-bus-pdz'
8676
params: {
8777
namePrefix: namePrefix
88-
defaultDomain: serviceBusDomainName
78+
defaultDomain: 'privatelink.servicebus.windows.net'
8979
vnetId: vnetId
90-
aRecords: [
91-
{
92-
name: 'default'
93-
ttl: 300
94-
ip: privateEndpoint.properties.ipConfigurations[0].properties.privateIPAddress
95-
}
96-
]
9780
tags: tags
9881
}
9982
}
83+
84+
module privateDnsZoneGroup '../privateDnsZoneGroup/main.bicep' = {
85+
name: '${namePrefix}-service-bus-privateDnsZoneGroup'
86+
dependsOn: [
87+
privateDnsZone
88+
]
89+
params: {
90+
name: 'default'
91+
dnsZoneGroupName: 'privatelink-servicebus-windows-net'
92+
dnsZoneId: privateDnsZone.outputs.id
93+
privateEndpointName: serviceBusPrivateEndpoint.name
94+
}
95+
}

0 commit comments

Comments
 (0)