Skip to content

Fix key vault secret name mismatch#1310

Merged
jasontaylordev merged 1 commit intojasontaylordev:mainfrom
danielvasas:fix-key-vault-secret-name-mismatch
Jul 25, 2025
Merged

Fix key vault secret name mismatch#1310
jasontaylordev merged 1 commit intojasontaylordev:mainfrom
danielvasas:fix-key-vault-secret-name-mismatch

Conversation

@danielvasas
Copy link
Copy Markdown
Contributor

Hey guys,

I've been having the issue that after each infrastructure deployment I had a new key vault secret version for the database passwords and connections string.

It sounds implausible that nobody else encountered this issue till now, so it can be that I'm missing something, but anyways, here's what I think is happening.

The key vault secret name for the database user and admin user in the main.parameters.json did not match the secret name in the [flexibleserver|sqlserver].bicep files.

The latter files are the ones that set the key vault secret names for the passwords. The main.parameters.json was referring to these secrets under different names, by which it never found a secret so it kept generating new passwords on each deployment.

e.g.:

      "dbAppUserPassword": {
        "value": "$(secretOrRandomPassword ${AZURE_KEY_VAULT_NAME} dbAppUserPassword)"
      }

The password doesn't get updated in the DB once it's been created, but the secret did get updated to a new version, resulting in the connection string getting invalid starting with the second deployment.

The key vault secret name for the database user and admin user in the main.parameters.json did not match the secret name in the [flexibleserver|sqlserver].bicep files.

The latter files are the one that save the passwords into the secrets, and because the secrets never get saved by the name that the main.parameters.json specifies, it kept generatign new passwords on each deployment. This resulted in the connection string getting invalid starting with the second deployment.
@jasontaylordev jasontaylordev merged commit dd3ac81 into jasontaylordev:main Jul 25, 2025
3 checks passed
@jasontaylordev
Copy link
Copy Markdown
Owner

Thank you 👍

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