Anaplan Connect Using Linux Script(Certificate Based Authentication)

Hi Team,

I am working on Anaplan Connect on Linux Platform tried run with credentials it worked, however, i am unable to run with certificate authentication.

Getting an error" -certificate is unknown token"

 

Please find the below code.

#!/bin/sh
# This example uploads a file and runs an import

WorkspaceId="'8a01b09d5v0b3c1c015a1eca06aa296d'"
ModelId="'77C397ECk35B4A238A5939B42tE098BC'"
Operation="certificate '/home/suk/Downloads/adar/anaplan-connect-1-3-3-5/anaplan.cer' -file 'sales.txt' -put '/home/suk/Downloads/adar/anaplan-connect-1-3-3-5/sales.txt' -import 'sales from sales.txt' -execute -output '/home/suk/Downloads/adar/anaplan-connect-1-3-3-5/Error/error.txt'"

#____________________________ Do not edit below this line ______________________________
if [ "${AnaplanUser}" ]; then
  Credentials="-user ${AnaplanUser}"
fi

echo cd "`dirname "$0"`"
cd "`dirname "$0"`"
if [ ! -f AnaplanClient.sh ]; then
  echo "Please ensure this script is in the same directory as AnaplanClient.sh." >&2
  exit 1
elif [ ! -x AnaplanClient.sh ]; then
  echo "Please ensure you have executable permissions on AnaplanClient.sh." >&2
  exit 1
fi
Command="./AnaplanClient.sh ${Credentials} -workspace ${WorkspaceId} -model ${ModelId} ${Operation}"
/bin/echo "${Command}"
exec /bin/sh -c "${Command}"

Best Answer

  • patilchhaya
    Answer ✓

    @AdarshMohapatra 

    Add -(hyphen) before certificate in operation and use the same action name in command(highlighted in green).

    Try the below code or you can also create a variable to initialize the certificate location, it can be used throughout the script.

     

    #!/bin/sh
    # This example uploads a file and runs an import
    WorkspaceId="'8a01b09d5v0b3c1c015a1eca06aa296d'"
    ModelId="'77C397ECk35B4A238A5939B42tE098BC'"
    Operation="-certificate '/home/suk/Downloads/adar/anaplan-connect-1-3-3-5/anaplan.cer' -file 'sales.txt' -put '/home/suk/Downloads/adar/anaplan-connect-1-3-3-5/sales.txt' -import 'sales from sales.txt' -execute -output '/home/suk/Downloads/adar/anaplan-connect-1-3-3-5/Error/error.txt'"

    #____________________________ Do not edit below this line ______________________________

    if [ "${AnaplanUser}" ]; then
      Credentials="-user ${AnaplanUser}"
    fi//Remove this

    echo cd "`dirname "$0"`"
    cd "`dirname "$0"`"
    if [ ! -f AnaplanClient.sh ]; then
      echo "Please ensure this script is in the same directory as AnaplanClient.sh." >&2
      exit 1
    elif [ ! -x AnaplanClient.sh ]; then
      echo "Please ensure you have executable permissions on AnaplanClient.sh." >&2
      exit 1
    fi
    Command="./AnaplanClient.sh ${certificate} -workspace ${WorkspaceId} -model ${ModelId} ${Operation}"
    /bin/echo "${Command}"
    exec /bin/sh -c "${Command}"

Answers