Working with a service agent from a job
Written by
Updated at April 11, 2025
You can work with other services from jobs using a service agent. A service agent is a special service account under which DataSphere projects will perform actions in other Yandex Cloud services.
You can work with other services from jobs using a service agent:
-
Run the job. The token for using the service agent will be saved to a file and will be available from the
SA_TOKEN_FILENAME
environment variable. -
Use the
SA_TOKEN_FILENAME
variable to work with other services. For example, this is how you can get the contents of the Yandex Lockbox secret using the API:curl --header "Authorization: Bearer $(cat $SA_TOKEN_FILENAME)" \ https://payload.lockbox.api.cloud.yandex.net/lockbox/v1/secrets/<secret_ID>/payload
Result:
{ "entries": [ { "key": "my-key", "textValue": "key-example" } ], "versionId": "e6qlcb7fqtt6********" }