File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7979 - name : Plan Cluster Resources
8080 id : deploy_cluster
8181 env :
82+ POSTGRES_ADMIN_OBJECT_ID : ${{ inputs.postgres_admin_object_id }}
8283 GOOGLE_OAUTH_CLIENT_ID : ${{ vars.GOOGLE_OAUTH_CLIENT_ID }}
8384 GOOGLE_OAUTH_CLIENT_SECRET : ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }}
8485 STRIPE_PUBLISHABLE_KEY : ${{ vars.STRIPE_PUBLISHABLE_KEY }}
@@ -144,6 +145,7 @@ jobs:
144145 - name : Deploy Cluster Resources
145146 id : deploy_cluster
146147 env :
148+ POSTGRES_ADMIN_OBJECT_ID : ${{ inputs.postgres_admin_object_id }}
147149 GOOGLE_OAUTH_CLIENT_ID : ${{ vars.GOOGLE_OAUTH_CLIENT_ID }}
148150 GOOGLE_OAUTH_CLIENT_SECRET : ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }}
149151 STRIPE_PUBLISHABLE_KEY : ${{ vars.STRIPE_PUBLISHABLE_KEY }}
@@ -161,9 +163,6 @@ jobs:
161163 - name : Install PostgreSQL Client
162164 run : sudo apt-get update && sudo apt-get install -y postgresql-client
163165
164- - name : Add PostgreSQL Admin
165- run : bash ./cloud-infrastructure/cluster/add-postgres-admin.sh ${{ inputs.unique_prefix }} ${{ inputs.azure_environment }} ${{ inputs.cluster_location_acronym }} ${{ inputs.postgres_admin_object_id }}
166-
167166 - name : Open Firewall
168167 working-directory : cloud-infrastructure/cluster
169168 env :
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ export UNIQUE_PREFIX
2929export ENVIRONMENT
3030export LOCATION=$CLUSTER_LOCATION
3131export DOMAIN_NAME
32+ export POSTGRES_ADMIN_OBJECT_ID
3233export GOOGLE_OAUTH_CLIENT_ID
3334export GOOGLE_OAUTH_CLIENT_SECRET
3435export STRIPE_PUBLISHABLE_KEY
105106 echo " BACK_OFFICE_IDENTITY_CLIENT_ID=$BACK_OFFICE_IDENTITY_CLIENT_ID " >> $GITHUB_OUTPUT
106107 echo " MAIN_IDENTITY_CLIENT_ID=$MAIN_IDENTITY_CLIENT_ID " >> $GITHUB_OUTPUT
107108 else
108- . ./add-postgres-admin.sh $UNIQUE_PREFIX $ENVIRONMENT $CLUSTER_LOCATION_ACRONYM $POSTGRES_ADMIN_OBJECT_ID
109109 . ./grant-database-permissions.sh $UNIQUE_PREFIX $ENVIRONMENT $CLUSTER_LOCATION_ACRONYM ' account' $ACCOUNT_IDENTITY_CLIENT_ID
110110 . ./grant-database-permissions.sh $UNIQUE_PREFIX $ENVIRONMENT $CLUSTER_LOCATION_ACRONYM ' back-office' $BACK_OFFICE_IDENTITY_CLIENT_ID
111111 . ./grant-database-permissions.sh $UNIQUE_PREFIX $ENVIRONMENT $CLUSTER_LOCATION_ACRONYM ' main' $MAIN_IDENTITY_CLIENT_ID
Original file line number Diff line number Diff line change @@ -15,6 +15,9 @@ param communicationServicesDataLocation string = 'europe'
1515param mailSenderDisplayName string = 'PlatformPlatform'
1616param revisionSuffix string
1717
18+ @description ('Object ID of the Entra ID security group for PostgreSQL administration' )
19+ param postgresAdminObjectId string = ''
20+
1821@secure ()
1922param googleOAuthClientId string
2023@secure ()
@@ -153,6 +156,7 @@ module postgresServer '../modules/postgresql-flexible-server.bicep' = {
153156 virtualNetworkId : virtualNetwork .outputs .virtualNetworkId
154157 isProduction : environment == 'prod'
155158 diagnosticStorageAccountId : diagnosticStorageAccount .outputs .storageAccountId
159+ dbAdminObjectId : postgresAdminObjectId
156160 }
157161}
158162
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ param backOfficeVersion = readEnvironmentVariable('BACK_OFFICE_VERSION')
1313param mainVersion = readEnvironmentVariable ('MAIN_VERSION' )
1414param applicationInsightsConnectionString = readEnvironmentVariable ('APPLICATIONINSIGHTS_CONNECTION_STRING' )
1515param revisionSuffix = readEnvironmentVariable ('REVISION_SUFFIX' )
16+ param postgresAdminObjectId = readEnvironmentVariable ('POSTGRES_ADMIN_OBJECT_ID' , '' )
1617param googleOAuthClientId = readEnvironmentVariable ('GOOGLE_OAUTH_CLIENT_ID' , '' )
1718param googleOAuthClientSecret = readEnvironmentVariable ('GOOGLE_OAUTH_CLIENT_SECRET' , '' )
1819param stripePublishableKey = readEnvironmentVariable ('STRIPE_PUBLISHABLE_KEY' , '' )
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ param subnetId string
66param virtualNetworkId string
77param isProduction bool
88param diagnosticStorageAccountId string
9+ @description ('Object ID of the Entra ID security group to assign as PostgreSQL administrator' )
10+ param dbAdminObjectId string = ''
911
1012resource postgresServer 'Microsoft.DBforPostgreSQL/flexibleServers@2025-08-01' = {
1113 name : name
@@ -44,6 +46,16 @@ resource postgresServer 'Microsoft.DBforPostgreSQL/flexibleServers@2025-08-01' =
4446 }
4547}
4648
49+ resource postgresServerAdministrator 'Microsoft.DBforPostgreSQL/flexibleServers/administrators@2025-08-01' = if (!empty (dbAdminObjectId )) {
50+ parent : postgresServer
51+ name : dbAdminObjectId
52+ properties : {
53+ principalName : 'PostgreSQL Admins - ${isProduction ? 'Production' : 'Staging' }'
54+ principalType : 'Group'
55+ tenantId : tenantId
56+ }
57+ }
58+
4759resource privateDnsZone 'Microsoft.Network/privateDnsZones@2024-06-01' = {
4860 name : 'privatelink.postgres.database.azure.com'
4961 location : 'global'
You can’t perform that action at this time.
0 commit comments