How do I create a script in AM (All versions) using Amster?
The purpose of this article is to provide information on automating the creation of scripts in AM rather than using the AM admin UI to create scripts.
1 reader recommends this article
Overview
You can use different approaches to automate the creation of scripts depending on your preference. This article demonstrates creating a script using Amster. You should refer to Scripting for information on creating scripts via the AM admin UI, REST and ssoadm.
Once you have created your script, you can verify it has been created in the AM admin UI by navigating to: Realms > [Realm Name] > Scripts > [Script Name].
Using Amster
The following example demonstrates creating a simple script using Amster; see Scripts for details of what values can be used in the language and context fields:
- Generate a base64 encoded version of your script (you could use the DS base64 tool to do this). For example, if your script was: logger.message("hello world");It would become the following after it was base64 encoded: bG9nZ2VyLm1lc3NhZ2UoImhlbGxvIHdvcmxkIik7
- Connect to AM using Amster, for example: $ ./amster am> connect --interactive https://am.example.com:8443/am Sign in to top level realm User Name: amAdmin Password: **********
- Create the script, where the id is your script ID and the script value is the base64 encoded value you generated in step 1. For example: am> create Scripts --realm / --id myScriptID --body '{"name":"myScript","description":"myDescription","script":"bG9nZ2VyLm1lc3NhZ2UoImhlbGxvIHdvcmxkIik7","language":"GROOVY","context":"POLICY_CONDITION"}'
See Also
How do I add logging to server-side scripts in AM 6.x?
What automation tools are available for installing, upgrading and configuring AM deployments?
Specify realms in REST API calls
Related Training
N/A
Related Issue Tracker IDs
N/A