Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection String Modified for Order Service #184

Merged
merged 5 commits into from
Nov 20, 2023

Conversation

yoshioterada
Copy link
Collaborator

@yoshioterada yoshioterada commented Sep 25, 2023

If I configured the original Connection String for Npgsql (C#),
following error was showed and couldn't start the order service.

Following is the actual Error during the startup the service.

Unhandled exception. System.ArgumentException: To validate server certificates, 
please use VerifyFull or VerifyCA instead of Require. To disable validation, 
explicitly set 'Trust Server Certificate' to true. 
See https://www.npgsql.org/doc/release-notes/6.0.html for more details.

So I modified the Connection String as follows.

az keyvault secret set --vault-name ${KEY_VAULT} \
    --name "ConnectionStrings--OrderContext" \
    --value "Server=${POSTGRES_SERVER_FULL_NAME}; \
             Database=${ORDER_SERVICE_DB};Port=5432; \
             SSL Mode=Require;Trust Server Certificate=true; \
             User ID=${POSTGRES_SERVER_USER}; \
             Password=${POSTGRES_SERVER_PASSWORD}"

And the above command worked fine with following with following result.

{
  "attributes": {
    "created": "2023-09-25T20:39:16+00:00",
    "enabled": true,
    "expires": null,
    "notBefore": null,
    "recoverableDays": 90,
    "recoveryLevel": "Recoverable+Purgeable",
    "updated": "2023-09-25T20:39:16+00:00"
  },
  "contentType": null,
  "id": "https://acme-fitness-********.vault.azure.net/secrets/ConnectionStrings--OrderContext/***************",
  "kid": null,
  "managed": null,
  "name": "ConnectionStrings--OrderContext",
  "tags": {
    "file-encoding": "utf-8"
  },
  "value": "Server=acme-fitness-db-******.postgres.database.azure.com;              Database=acmefit_order;Port=5432;              SSL Mode=Require;Trust Server Certificate=true;              User ID=acme;              Password=*********"
}

If I configured the Connection String for Npgsql (C#).
Following error was showed and couldn't start the order service.

So I modified to be able to access to the PostgreSQL from the catalog service.

```bash
az keyvault secret set \
    --vault-name acme-fitness-kv-yoshio \
    --name "ConnectionStrings--OrderContext" \
    --value "Server=$POSTGRES_SERVER.postgres.database.azure.com;Database=$ORDER_SERVICE_DB;Port=5432;SSL Mode=Require;Trust Server Certificate=true;User ID=$POSTGRES_SERVER_USER;Password=$POSTGRES_SERVER_PASSWORD"
```

```text
Unhandled exception. System.ArgumentException: To validate server certificates, please use VerifyFull or VerifyCA instead of Require. To disable validation, explicitly set 'Trust Server Certificate' to true. See https://www.npgsql.org/doc/release-notes/6.0.html for more details.
```
I modified the expression of the env variables
I modified the style with more visible.

I also tried to the separate line and works fine.
@dingmeng-xue dingmeng-xue merged commit 677faae into Azure-Samples:Azure Nov 20, 2023
1 check passed
xtreme-brian-shim pushed a commit to svrc/acme-fitness-store that referenced this pull request Aug 22, 2024
* Link missing for Deploy to Azure

If I push the link of the "Deploy to Azure" button, it failed to show the Form in the Azure Portal.

And it seems that the link had changed as follows.

Previous Link (Currently Failed)
https://raw.githubusercontent.com/Azure-Samples/acme-fitness-store/Azure/workshops/azure-spring-apps-enterprise/full/03-workshop-environment-setup/acmedeploy.json)

Now (Correct Link)
https://raw.githubusercontent.com/Azure-Samples/acme-fitness-store/Azure/azure-spring-apps-enterprise/workshops/azure-spring-apps-enterprise/full/03-workshop-environment-setup/acmedeploy.json

So I modified the link for it.

* Connection String Modified for Order Service

If I configured the Connection String for Npgsql (C#).
Following error was showed and couldn't start the order service.

So I modified to be able to access to the PostgreSQL from the catalog service.

```bash
az keyvault secret set \
    --vault-name acme-fitness-kv-yoshio \
    --name "ConnectionStrings--OrderContext" \
    --value "Server=$POSTGRES_SERVER.postgres.database.azure.com;Database=$ORDER_SERVICE_DB;Port=5432;SSL Mode=Require;Trust Server Certificate=true;User ID=$POSTGRES_SERVER_USER;Password=$POSTGRES_SERVER_PASSWORD"
```

```text
Unhandled exception. System.ArgumentException: To validate server certificates, please use VerifyFull or VerifyCA instead of Require. To disable validation, explicitly set 'Trust Server Certificate' to true. See https://www.npgsql.org/doc/release-notes/6.0.html for more details.
```

* Modified Env Value

I modified the expression of the env variables

* I modified the style with more visible

I modified the style with more visible.

I also tried to the separate line and works fine.
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.

2 participants