Automic Workload Automation

 View Only

 Retrieve password from Promptset

Didjit86's profile image
Didjit86 posted Jan 30, 2025 11:12 AM

Hi,

I have this almost working, but I can't figure out how to decript a Promptset password to be used in a python script. Snippit below, USERNAME passes in fine, stuck on password and token, which are obfuscated in the Promptset. 

:BEGIN_EXT_INT PYTHON

import os
import sys
import subprocess

# Get the environment variables passed from Automic
username = "&USERNAME#"
password = "&PASSWORD#"
token = "&TOKEN#"

Any ideas? Sorry if this is trivial, bit new to Automic. All my googles have failed me. Thanks!

Hi, Narasimha Gudi  , I tried you suggestion and immediatly "get Variable '--102CBDA99592F74E20' not found." , which looks like the encrypted value. 

For some reason, I cannot reply to the thread, annoying.

Narasimha Gudi's profile image
Broadcom Knight Narasimha Gudi

Hi,

Assuming you are passing values from promptset using a variable, here's the block of Automic AE script that you can include:

:SET &HND#=PREP_PROCESS_VAR(VARA.YOUR_VARIABLE)

:PROCESS &HND#

:PSET &VC# = GET_PROCESS_LINE(&HND#,1)

:PSET &PASSWORD# = GET_PROCESS_LINE(&HND#,2)

:PRINT "&VC# &PASSWORD#"

:ENDPROCESS

:CLOSE_PROCESS &HND#

You can later use the password in your Python script by calling the variable "&PASSWORD#".

Use this in the Pre-Process tab. Once done adding this block, you can click on "More" drop down menu and select "Reformat All" to reformat the script with proper indentation.

Michael Dolinek's profile image
Broadcom Employee Michael Dolinek

Hi @Didjit86

you can also use a module that comes with the ITPA Shared Action Pack.

Sample

!Get encrypted token value
:SET &UC4RB_ENCRYPTED_PASSWORD_TMP#="&PW_FROM_PROMPT#"
:INCLUDE PCK.ITPA_SHARED.PRV.INCLUDE.DECRYPT_PASSWORD
:SET &PW_CLEAR# = "$UC4_DECRYPTED_PWD"

There might be some adoptions needed when using it with Python

Hope this helps

Michael

Eric Lontz's profile image
Eric Lontz

Part of the issue you are running into is because you are using a python interpreter but you need Automics to convert the password.

First I would rewrite this to be a python script, such as myscript.py and have it accept arguments being passed in, those will be the username, password and token. You would need to call it via &UC_JOBMD CMD

Example process tab

&UC_JOBMD CMD="python myscript.py &USERNAME# &PASSWORD# &TOKEN#"

Example script contents for myscript.py

import os
import sys
import subprocess

uid = int(sys.argv[1])
pwd= int(sys.argv[2])
tkn= int(sys.argv[3])
print ("uid is the username, pwd is the password, tkn is the token")