Skip to content

Commit

Permalink
Merge pull request #62 from pamelafox/fixcicd
Browse files Browse the repository at this point in the history
Possible fix for CI permission
  • Loading branch information
pamelafox authored Apr 22, 2024
2 parents 285e6cb + 4c2c653 commit 187d24c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
20 changes: 7 additions & 13 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,11 @@ param name string
@description('Primary location for all resources')
param location string

@description('Entra admin role name')
param postgresEntraAdministratorName string
@description('Id of the user or app to assign application roles')
param principalId string

@description('Entra admin role object ID (in Entra)')
param postgresEntraAdministratorObjectId string

@description('Entra admin user type')
@allowed([
'User'
'Group'
'ServicePrincipal'
])
param postgresEntraAdministratorType string = 'User'
@description('Whether the deployment is running on GitHub Actions')
param runningOnGh string = ''

var resourceToken = toLower(uniqueString(subscription().id, name, location))
var tags = { 'azd-env-name': name }
Expand All @@ -35,8 +27,10 @@ resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
var prefix = '${name}-${resourceToken}'

var postgresServerName = '${prefix}-postgresql'
var postgresAdminUser = 'admin${uniqueString(resourceGroup.id)}'
var postgresDatabaseName = 'flask'
var postgresEntraAdministratorObjectId = principalId
var postgresEntraAdministratorType = empty(runningOnGh) ? 'User' : 'ServicePrincipal'
var postgresEntraAdministratorName = 'admin${uniqueString(resourceGroup.id, principalId)}'

module postgresServer 'core/database/postgresql/flexibleserver.bicep' = {
name: 'postgresql'
Expand Down
9 changes: 3 additions & 6 deletions infra/main.parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@
"location": {
"value": "${AZURE_LOCATION}"
},
"postgresEntraAdministratorName": {
"value": "useradmin"
},
"postgresEntraAdministratorObjectId": {
"principalId": {
"value": "${AZURE_PRINCIPAL_ID}"
},
"postgresEntraAdministratorType": {
"value": "User"
"runningOnGh": {
"value": "${GITHUB_ACTIONS}"
}
}
}

0 comments on commit 187d24c

Please sign in to comment.