Skip to content

Support both password and passwordless auth type for PostgreSQL and MySQL#6

Merged
rujche merged 4 commits into
saragluna:java-analyzerfrom
rujche:rujche/java-analyzer
Oct 12, 2024
Merged

Support both password and passwordless auth type for PostgreSQL and MySQL#6
rujche merged 4 commits into
saragluna:java-analyzerfrom
rujche:rujche/java-analyzer

Conversation

@rujche

@rujche rujche commented Oct 11, 2024

Copy link
Copy Markdown
Collaborator

}

authType := scaffold.AuthType(0)
selection, err := i.console.Select(ctx, input.ConsoleOptions{

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saragluna, With this method, customer can choose with ⬆️ and ⬇️ in keyboard. This method is copied from here:

image

If you agree, I'm willing to convert Service Bus to this method. Here is current method in Service Bus:

image

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option is make it like choosing subscription and location. We can do it in another PR.
Here is the screenshot of choosing subscription and location:

image

}
{{- end}}
{{- if .DbMySql}}
{{- if (and .DbPostgres .DbPostgres.AuthUsingManagedIdentity)}}

@rujche rujche Oct 11, 2024

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: I changed the order of MySQL and PostgreSQL here: Always keep PostgreSQL on top of MySQL in all related fragments.

azCliVersion: '2.63.0'
timeout: 'PT10M'
scriptContent: 'apk update; apk add g++; apk add unixodbc-dev; az extension add --name containerapp; az extension add --name serviceconnector-passwordless --upgrade; az containerapp connection create postgres-flexible --connection appLinkToPostgres --source-id ${app.id} --target-id ${postgresDatabaseId} --client-type springBoot --user-identity client-id=${identity.properties.clientId} subs-id=${subscription().subscriptionId} user-object-id=${linkerCreatorIdentity.properties.principalId} -c main --yes; az tag create --resource-id ${app.id} --tags azd-service-name={{.Name}} '
scriptContent: 'apk update; apk add g++; apk add unixodbc-dev; az extension add --name containerapp; az extension add --name serviceconnector-passwordless --upgrade; az containerapp connection create mysql-flexible --connection appLinkToMySql --source-id ${app.id} --target-id ${mysqlDatabaseId} --client-type springBoot --user-identity client-id=${identity.properties.clientId} subs-id=${subscription().subscriptionId} user-object-id=${linkerCreatorIdentity.properties.principalId} mysql-identity-id=${mysqlIdentityName} -c main --yes;'

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align PostgreSQL and MySQL, I deleted az tag create here. I tested, there is no problem. If tag problem happens again, we add it in both PostgreSQL and MySQL.

{{- end}}

{{- if (and .AzureServiceBus .AzureServiceBus.AuthUsingManagedIdentity) }}

@rujche rujche Oct 11, 2024

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: The empty line will be kept in the generated bicep file only when the empty line put after fragment like {{-if.

}
}
{{- end}}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The empty line will be deleted in the generated bicep file.

scope: rg
}
{{- if (or (or (or .DbCosmosMongo .DbPostgres) .DbMySql) (and .AzureServiceBus .AzureServiceBus.AuthUsingConnectionString))}})))}}
{{- if (or (or (or .DbCosmosMongo .DbPostgres) .DbMySql) (and .AzureServiceBus .AzureServiceBus.AuthUsingConnectionString))}}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saragluna . FYI: This is a bug. I fixed it in here.

selection, err := i.console.Select(ctx, input.ConsoleOptions{
Message: "Input the authentication type you want for database:",
Options: []string{
"Use user assigned managed identity",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: Set Use user assigned managed identity as the first option.

@rujche rujche merged commit 207ffa3 into saragluna:java-analyzer Oct 12, 2024
saragluna pushed a commit that referenced this pull request Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant