If I run az vm list
it will output JSON which I can save to a text file. What if instead I wanted to save it to a database, like MongoDB? How would that work?
CodePudding user response:
It is very simple to take JSON and dump it into mongodb. Azure CLI tends to emit responses as arrays, so to save it to mongodb, use mongoimport
with the --jsonArray
argument, e.g.
az vm list > /tmp/z && mongoimport --uri 'mongodb://localhost:37017/someDB' -c someCollection --jsonArray /tmp/z