9. Variables and secrets
Requirements
- You have done all the previous tutorials
What you will learn
- How to properly store secrets like login, password, tokens.
- How to set global variables for your Jobs.
Go to Settings > Data Factory > Variables
As you can see in the thumbnail, you can use variables to store:
- Values that can be set globally in your Jobs, like your brand name
- Protected content like login, password, tokens...
These variables are then accessible in your Jobs with:
json
"${workflow.variable.variable_key}"
1
For example in a FTP Get task:
json
{
"name": "protocol-ftp-get",
"taskReferenceName": "ftp_get",
"description": "The business description of the task",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"connection": "SFTP",
"host": "${workflow.variable.main_ftp_host}",
"username": "${workflow.variable.main_ftp_login}",
"password": "${workflow.variable.main_ftp_password}",
"port": "${workflow.variable.main_ftp_port}",
"mode": "PARAMETERS",
"remoteFolder": "/",
"sort": "LAST_MODIFIED_DESC",
"filter": "-products\\.xml$",
"maxFiles": 1
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
In this way, if the credentials of the FTP changes, then you just have to update the variables values and not to update all your Jobs individually.
Best practice
Always use variables to store login, password, tokens...
What you have learned
You can simply create global variables accessible within your Jobs. These variables can be protected and must be used to store login, password, tokens...
Next
You will learn about how to generate and validate xslt files.