In the past I have used a random password generation function to do this using inline powershell in ARM/bicep templates and/or scripts then storing those in keyvaults. I am not aware of any means of doing this solely with keyvault.
Hope this helps
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hey guys,
I have my open source postgresql deployed in Azure VMs. I would like to generate dynamic passwords for the database users using Azure Key Vault. Is it typically possible? If yes, can you please help down with steps or redirect me to right documentation?
In the past I have used a random password generation function to do this using inline powershell in ARM/bicep templates and/or scripts then storing those in keyvaults. I am not aware of any means of doing this solely with keyvault.
Hope this helps
Hi M, Anbazhagan,
Thanks for reaching out to Microsoft Q&A.
after creating a secret in your Azure Key Vault that contains the password, you can try this...
To Retrieve the secret value
secret_value=$(az keyvault secret show --name AdminPassWord --vault-name <your-keyvault-name> --query value -o tsv)
Creating the PostgreSQL server
--az postgres server create \
--location <location> \
--resource-group <resource-group-name> \
--name <PostgresServerName> \
--admin-user <AdminUserName> \
--admin-password "$secret_value" \
--sku-name <pgSkuName>
```Alternatively, you can use the terraform to generate a password dynamically and store it in Azure Key Vault.
[https://blog.posedio.com/blog/postgres-database-crednetials-with-hashicorp-vault](https://blog.posedio.com/blog/postgres-database-crednetials-with-hashicorp-vault)
Please 'Upvote'(Thumbs-up) and 'Accept' as an answer if the reply was helpful. This will benefit other community members who face the same issue.