-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Creating complex object variable in ARM templating #9
Comments
You should be able to do this by specifying the value as a JSON object instead of a simple string. For example, a variable named abc whose value was a dictionary with keys Key1 = Value1 and Key2 = 123 would look something like:
|
Is it possible to actually pass in an arm object type in as a parameter? For example an param object such as this: "adSettings": { My end goal is to import this into a complex object variable, either by straight import like the above or to a runbook that can do the powershell (New-AzureAutomationVariable) to import it. |
Yes, you should be able to pass in a JSON object as a parameter and the use it in the template. See https://azure.microsoft.com/en-us/documentation/articles/resource-group-authoring-templates/#parameters. From: Matt Shorrosh [mailto:[email protected]] Is it possible to actually pass in an arm object type in as a parameter? For example an param object such as this: "adSettings": { My end goal is to import this into a complex object variable, either by straight import like the above or to a runbook that can do the powershell (New-AzureAutomationVariable) to import it. — |
As Beth says, yes you can parameterize the value of anything in an ARM template. If you are asking if you can pass that param value as an object for variable assets specifically, the answer is no, because the value property of a variable asset only accepts strings. So you need to pass the JSON representing the object as a string, for the param value. For my example above, this would be:
|
OK thanks for answering Joe, that was the intent of my question. Sorry I wasn't very clear there. As an alternative, can I pass the JSON representing the object as a parameter to a Runbook Job? I'm thinking in the runbook I can create the complex object variables in AA that that way via powershell (New-AzureAutomationVariable) instead of ARM. I have some large object JSONs that are used throughout a ARM template solution, and I have this all tied in with Azure Automation, I would like to have the same objects used in my arm template available as variables that I can reference in DSC scripts. |
I think that would work, yes |
Attempting to pass in a json object to a run book I am getting this error as well: JSON OBJECT as a variable: "sqlSettings": { Parameter of object passed down to my linked template where the Runbook Job ARM is located: ARM Code for Runbook Job: "properties": { Error: 14:49:30 - [ERROR] '{"Message":"The request is It seems that only strings can be used as input parameters to runbooks from ARM? |
You have:
But I can see sqlSettings is not a parameter, since you are constructing it in the ARM template. Did you mean this?
|
As far as the sqlSettings it is a variable originally in a main deployment template (which is what I showed for reference). It is actually being passed via a parameter to a linked template where the Runbook Job ARM code is living at. So parameters is actually correct in my test case here. |
You may want to start with a simple ARM template that just creates a job with a JSON object as a param value, to see if that works, to limit out any other issues causing this. If it does not work, try switching the param value to be a JSON string of the same JSON object, and see if that works. If that second way works then it appears my dev contact informed me incorrectly that JSON objects could be passed instead of only JSON strings, for job param values |
Hi
Is there currently a way to create a complex object Azure Automation Variable via ARM?
Thanks
Matt
The text was updated successfully, but these errors were encountered: