I have Mesosphere DC/OS installed on Azure cluster, running tomcat apps as services, those services are configured using JSON files holding the ports and passwords of the apps. My Manager wants to use Azure Key Vault to store the passwords and secrets of the apps, i created the vault and stored in it the secrets i need.
This is a part of my JSON values which i need to replace: (i cut only the fields with the values i want to replace from the Vault)
"APP_ACCESS_SERVICE_PASSWORD": "AppPW",
"CASSANDRA_DB_PASSWORD": "App_uat_PW",
"UAMS_ORACLE_PASSWORD": "App_uat_PW",
"PUBLISH_DB_PASSWORD": "ogw",
"App-PUBLISH_DB_PASSWORD": "App_uat1",
"EMP_DB_PASSWORD": "App_uat1",
How can i replace the passwords in my JSON with the values in the key vault ? i mean putting a URL to the password instead of the password is not an option, any Idea how can i input the values in the key vault into the JSON instead of the static values ? From Azure documentation i see that i can access the values using URL, for example: https://Contoso-Vault2.vault.azure.net/secrets/ExamplePassword but using URL instead of the value is not an option. (it won't work)
I assume you have a pipeline but here's how you could do it.
First create your secrets in your desired key vault. I have created an app using Python and the Azure sdk which lets you create multiple secrets in a key vault very easily - https://github.com/TechyTish/AzurePy/blob/main/create-azure-secrets-README.md
lets say your secrets are stored as (secretName: secretValue):
... etc
Create a YAML pipeline which will have 2 tasks:
Underneath the previous task add another one. This looks for any key value with the {# pre-fix and #} suffix in the .json file and the variables (below) after this task will replace the value in the .json file with the value of the secrets you assigned it.
Run the pipeline (tick the box for debugging) and your output of .json file should be:
This way the only time your secrets are revealed is when the pipeline is run on whichever host agent (virtual machine) you use.