Writing json to vault via the vault cli
To read data from vault
vault read secret/my_data
This will display something like
Key Value
--- -----
refresh_interval 768h
client_namespaces dummy1,dummy2,dummy3
enabled 1
env_tag NonProduction
event_hub_namespace dummy-eventhub
message_retention 1
partition_count 3
version 0.0.1
To display in json format
vault read --format=json secret/my_data
Which will display
{
"request_id": "3636eda1-c052-eb0c-b1c6-3bfff43d86e3",
"lease_id": "",
"lease_duration": 2764800,
"renewable": false,
"data": {
"client_namespaces": "dummy1,dummy2,dummy3",
"enabled": "1",
"env_tag": "NonProduction",
"event_hub_namespace": "dummy-eventhub",
"message_retention": "1",
"partition_count": "3",
"version": "0.0.1"
},
"warnings": null
}
You can dump the data section to a file...
vault read --format=json secret/my_data | jq .data > my_data.json
This will dump the following to a my_data.json
{
"client_namespaces": "dummy1,dummy2,dummy3",
"enabled": "1",
"env_tag": "NonProduction",
"event_hub_namespace": "dummy-eventhub",
"message_retention": "1",
"partition_count": "3",
"version": "0.0.1"
}
Edit this to suit your needs and write to back to vault as follows...
vault write secret/my_data @my_data.json