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 Feb 24, 2021

The purpose of this article is to provide information on automating the creation of scripts in AM rather than using the console 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 Getting Started with Scripting for information on creating scripts via the console, REST and ssoadm.

Once you have created your script, you can verify it has been created in the console by navigating to: Realms > [Realm Name] > Scripts > [Script Name], for example:

Using Amster

The following example demonstrates creating a simple script using Amster; see Entity Reference › 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 http://host1.example.com:8080/openam 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 (All versions)?

What automation tools are available for installing, upgrading and configuring AM deployments (All versions)?

Installing and configuring AM

Using the REST API in AM

Using Amster in AM

Getting Started with Scripting

Getting Started with REST › Specifying Realms in REST API Calls

Related Training

N/A

Related Issue Tracker IDs

N/A


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