Reputation: 12545
I've been using Azure Automation for a couple tasks such as shutting down VMs, removing cloud service slots (staging) when we aren't using it.
This all works great, I have a lot of these VM/cloud service name defined in the code itself. I want to make it a little cleaner for our team to work with. My idea was to define a json file with this information and have the script read the values from the json file.
Does Azure Automation allow the use of a json file? I don't see it as a "Setting type". If that capability isn't allowed does anyone have any other creative ways to solve this?
Upvotes: 0
Views: 2738
Reputation: 3341
There's nothing stopping you from using the variable type (string) to store json. The UI's one-line dialog is not optimal for viewing the data, but storing it shouldn't be a problem. You can use PowerShell's convertfrom-json to read the data
workflow jsontest
{
$a = Get-automationVariable -name "jsontest"
$ba = $a | convertfrom-json
}
A better approach might be to save the json data as a text file and store it elsewhere, such as blob storage but that depends on how often the data changes I guess.
Upvotes: 2