Prerequisites:

-This article is designed for those more advanced with Anaplan Connect

-Utilizing CA Certificates is best practice for Anaplan Data Integrations. The Variables file method is best leveraged with CA Certificate authentication in the individual scripts for security purposes. If you would like to learn more about CA Certificates, click on the guide below which I co-authored. Note: Basic Authentication used for demo purposes.

Interactive CA Certificate Guide

Imagine this scenario: you have an Anaplan Connect environment running integration jobs for multiple workspaces and models. You have lots of scripts in your Anaplan Connect folder. You are seeking to optimize your Anaplan Connect setup from a performance, security, and maintenance standpoint.

Solution: Create a Variables File! The Variables file method allows you to store your IDs and credentials in a separate file. Think of this almost like a system module or administration module in Anaplan. Here you will create all of your variables which your individual scripts can reference. This method adds another layer of encryption which allows you to mask your IDs and credentials in your individual scripts. Leveraging concepts in weeks 1 and 2 of this series, we will tie everything together with this week's article.

Here's how: creating a Variables file is a simple process! This will require some attention to detail and careful organization.

  1. Create your Variables file. The Variables file will contain all of your authentication credentials, workspaceIDs, modelIDs, imports, processes, and file paths.
  2. Utilize "REM" throughout your scripts for organizing different types of variables in your file.

----------------------

Example Variables File


REM Authentication Method
Set Certificate="YourCertificatePath"
Set PrivateKey="YourPrivateKey:"
Set AnaplanUser="Youremailaddress:"


REM Workspaces
Set Workspace1="Your Workspace1 ID"
Set Workspace2="Your Workspace2 ID"


REM ---- Workspace1 Variables -----

REM ModelA
Set ModelA="Your ModelA ID"


REM ModelA Processes
Set ProcessA= "Your ProcessA"


REM ModelA Imports
Set ImportA= "Your ImportA"


REM ----Workspace2 Variables-----
Set ModelB="Your ModelB ID"


REM ModelB Processes
Set ProcessB= "Your ProcessB"

REM ModelB Imports
Set ImportB="Your ImportB"

----------------------

3. Point your individual scripts to the Variables file utilizing the "Call" command.

----------------------

ModelAExample that calls Variables File:

@echo off


call setvariables.bat


set Cert=%Certificate%
set Key=%PrivateKey%
set WorkspaceId=%Workspace1%
set ModelId=%ModelA%


set ServiceUrl="https://api.anaplan.com"
set AuthUrl="https://auth.anaplan.com"


set Chunksize=1


set Operation=-debug -process %ProcessA% -execute


rem *** End of settings - Do not edit below this line ***


setlocal enableextensions enabledelayedexpansion || exit /b 1
cd %~dp0
set Credentials=-certificate %Certificate% -pkey %Key%
set Command=.\AnaplanClient.bat %Credentials% -service %ServiceUrl% -auth %AuthUrl% -workspace %WorkspaceId% -model %ModelId% %Operation%
@echo %Command%
cmd /c %Command%

----------------------

4. Notice that the Certificate, Private Key, Workspace ID, and Model IDs are contained within "%" symbols and do not display the specific IDs or paths in the script. This is because the IDs are actually being retrieved from the variables file, leveraging the "Call" command near the top of the script. Also notice there is no "pause" command at the end of the script.

----------------------

ModelBExample that calls Variables File:

@echo off


call setvariables.bat


set Cert=%Certificate%
set Key=%PrivateKey%
set WorkspaceId=%Workspace2%
set ModelId=%ModelB%


set ServiceUrl="https://api.anaplan.com"
set AuthUrl="https://auth.anaplan.com"


set Chunksize=1


set Operation=-debug -process %ProcessB% -execute


rem *** End of settings - Do not edit below this line ***


setlocal enableextensions enabledelayedexpansion || exit /b 1
cd %~dp0
set Credentials=-certificate %Certificate% -pkey %Key%
set Command=.\AnaplanClient.bat %Credentials% -service %ServiceUrl% -auth %AuthUrl% -workspace %WorkspaceId% -model %ModelId% %Operation%
@echo %Command%
cmd /c %Command%
Pause

----------------------

5. Above is another script that points to a different model, workspace and process located in the variables file. Notice the "pause" command at the bottom of the script.

You now have individual scripts that successfully point to Variables files!

Create your Master Script!

----------------------

MasterScript with Variables file example:

CallModelAExample
CallModelBExample

----------------------

Your folder should look something like this:

No alt text provided for this image

6. Run your Master Script!

Your end result should look something like this (sanitized output log, Basic Auth used for demo purposes):

No alt text provided for this image

Use Cases

-Variables files can add a layer of masking scripts for any Anaplan Connect environment

-Variables files and Master Scripts can optimize any Anaplan Connect environment managing multiple scripts with multiple models, workspaces, processes, actions etc.

Things to Consider

-Wake Up Scripts can be combined with the Variables files and Master Scripts method to merge concepts from Weeks 1-3

-Leveraging Wake Up Scripts, Master Scripts, and Variables files can all boost performance in your Anaplan Connect environment