DEEP DIVE: Pass parameters to a script via JSON or CSV
In the "Deep Dive" you learn how exactly parameters are transferred to a script via JSON or CSV file.
The following chapters describe:
- General: Include a template with a script call in ARM. Described using the example "Disable a user via GrantMA".
- In detail: Pass the parameters to the script via JSON or CSV.
Background / Value
Ordering a new user on the GrantMA Self-Service Portal is natively supported by ARM. Disabling a user after the order workflow has been completed becomes possible through the use of scripts. The combination GrantMA - Scripts - ARM webAPI opens up a multitude of further possibilities to automate documented processes.
An example is the option described below of ordering the deactivation of a user:
- Define an open template and ask for required values in a request in GrantMA.
- After approval, the values are passed to a script.
- The script controls ARM via the webAPI to perform the required action in ARM.
- ARM executes the action and logs it in the ARM logbook.
The transfer of parameters to the script can be done either directly or through a JSON or CSV file. The direct entry is described in the previous section "Disabling a user via GrantMA".
Using a JSON or CSV file is especially convenient if you want to pass many parameters to a script. In particular, the JSON format in Powershell can be used immediately as an object.
Here's a sample PowerShell script that simply outputs the parameters passed by JSON.
# example for reading json formatted data addressed by $json over command line
# Read all data from json file into an object
(Get-Content $json) -join "`n" | ConvertFrom-Json | Write-Host
# here you can alternatively assign and compute the object
Configuration of the script
Supported field types / input options from the templates
Returns the text content. If the field is empty, it will not be transported.
Returns the value of the selection, not the display value.
Returns the text "
True" if the box was selected, otherwise "
Returns the text of the selected time. The output format can be influenced by the parameter "ScriptParameterFormat".(.net definitions).
Returns the text of the selected radio button. The key is the Radio GroupId.
"OnBoardingUser": "Horst Peter (arm-demo\\H.Peter)",
"DropDownValue": "Value B",