Use to AVM to support PostgreSql#9
Conversation
| { | ||
| principalId: connectionCreatorIdentity.outputs.principalId | ||
| principalType: 'ServicePrincipal' | ||
| roleDefinitionIdOrName: 'b24988ac-6180-42a0-ab88-20f7382dd24c' |
There was a problem hiding this comment.
The b24988ac-6180-42a0-ab88-20f7382dd24c is not easy to read. It can be change to display name.
Refs:
https://github.com/Azure/bicep-registry-modules/tree/main/avm/res/app/container-app
To keep it align with other places in current file, let's keep it in GUID format. We can change all GUID into display name in another PR.
There was a problem hiding this comment.
Let's hold on this change, since I am not sure whether the name can be changed.
| { | ||
| principalId: connectionCreatorIdentity.outputs.principalId | ||
| principalType: 'ServicePrincipal' | ||
| roleDefinitionIdOrName: 'b24988ac-6180-42a0-ab88-20f7382dd24c' |
There was a problem hiding this comment.
This role is added in 4 scopes:
- Azure Container Apps Environment.
- Azure Container Apps
- Azure Container Apps managed identity
- Azure Database for PostgreSQL.
Delete any one of above 4 scopes will cause az containerapp connection fail.
There was a problem hiding this comment.
Without ACA environment, it will return error like Can not read xxx in environment xxx.
| if spec.DbMySql != nil { | ||
| spec.Parameters = append(spec.Parameters, | ||
| Parameter{ | ||
| Name: "mysqlDatabasePassword", |
There was a problem hiding this comment.
Use different parameter name will make the bicep file easier to understand.
| connectionCreatorIdentity.outputs.resourceId | ||
| ] | ||
| } | ||
| runOnce: false |
There was a problem hiding this comment.
So we are still use deployment script to do the trick, does any database avm support passwordless yet?
There was a problem hiding this comment.
What does this mean?
This parameter can solve this problem: https://github.com/azure-javaee/azure-dev/wiki/Knowledge-Sharing#solution
There was a problem hiding this comment.
So we are still use deployment script to do the trick, does any database avm support passwordless yet?
We are still use deployment script to do the trick
| { | ||
| name: 'POSTGRES_URL' | ||
| secretRef: 'db-url' | ||
| secretRef: 'postgresql-db-url' |
There was a problem hiding this comment.
The POSTGRES_URL containers password. Keep the original implementation in this PR.
| name: 'POSTGRES_PASSWORD' | ||
| secretRef: 'db-pass' | ||
| name: 'SPRING_DATASOURCE_URL' | ||
| value: 'jdbc:postgresql://${postgreServer.outputs.fqdn}:5432/${postgreSqlDatabaseName}' |
There was a problem hiding this comment.
SPRING_DATASOURCE_URL doesn't contain password.


Switch to AVM for PostgreSql.
Link to sample project: https://github.com/rujche/spring-petclinic/tree/rujche/use-postgresql-support-both-password-and-passwordless