@@ -2,6 +2,8 @@ param name string
22param location string
33param tags object
44param tenantId string
5+ param subnetId string
6+ param virtualNetworkId string
57
68resource postgresServer 'Microsoft.DBforPostgreSQL/flexibleServers@2025-08-01' = {
79 name : name
@@ -35,12 +37,56 @@ resource postgresServer 'Microsoft.DBforPostgreSQL/flexibleServers@2025-08-01' =
3537 }
3638}
3739
38- resource postgresVirtualNetworkRule 'Microsoft.DBforPostgreSQL/flexibleServers/firewallRules@2025-08-01' = {
39- parent : postgresServer
40- name : 'allow-azure-services'
40+ resource privateDnsZone 'Microsoft.Network/privateDnsZones@2024-06-01' = {
41+ name : 'privatelink.postgres.database.azure.com'
42+ location : 'global'
43+ tags : tags
44+ }
45+
46+ resource privateDnsZoneVnetLink 'Microsoft.Network/privateDnsZones/virtualNetworkLinks@2024-06-01' = {
47+ parent : privateDnsZone
48+ name : '${name }-vnet-link'
49+ location : 'global'
50+ properties : {
51+ virtualNetwork : {
52+ id : virtualNetworkId
53+ }
54+ registrationEnabled : false
55+ }
56+ }
57+
58+ resource privateEndpoint 'Microsoft.Network/privateEndpoints@2025-01-01' = {
59+ name : '${name }-postgres-private-endpoint'
60+ location : location
61+ tags : tags
62+ properties : {
63+ subnet : {
64+ id : subnetId
65+ }
66+ privateLinkServiceConnections : [
67+ {
68+ name : '${name }-postgres-connection'
69+ properties : {
70+ privateLinkServiceId : postgresServer .id
71+ groupIds : ['postgresqlServer' ]
72+ }
73+ }
74+ ]
75+ }
76+ }
77+
78+ resource privateDnsZoneGroup 'Microsoft.Network/privateEndpoints/privateDnsZoneGroups@2025-01-01' = {
79+ parent : privateEndpoint
80+ name : 'default'
4181 properties : {
42- startIpAddress : '0.0.0.0'
43- endIpAddress : '0.0.0.0'
82+ privateDnsZoneConfigs : [
83+ {
84+ name : 'postgres'
85+ properties : {
86+ privateDnsZoneId : privateDnsZone .id
87+ }
88+ }
89+ ]
4490 }
4591}
4692
0 commit comments