How To
ForgeRock Identity Platform
Does not apply to Identity Cloud

How do I create a script in AM (All versions) using Amster?

Last updated Jan 18, 2023

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


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:

  1. 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
  2. Connect to AM using Amster, for example: $ ./amster am> connect --interactive Sign in to top level realm User Name: amAdmin Password: **********
  3. 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?

Installing and configuring AM

Using the REST API in AM

Using Amster in AM


Specify realms in REST API calls

Related Training


Related Issue Tracker IDs


Copyright and Trademarks Copyright © 2023 ForgeRock, all rights reserved.