From within the script of a run submitted using submit_experiment(), you can use get_secrets_from_run() to get secrets that are stored in the keyvault of the associated workspace.

Note that this method is slightly different than get_secrets(), which first requires you to instantiate the workspace object. Since a submitted run is aware of its workspace, get_secrets_from_run() shortcuts workspace instantiation and returns the secret value directly.

Be careful not to expose the secret(s) values by writing or printing them out.

get_secrets_from_run(run, secrets)



The Run object.


A vector of strings of secret names to retrieve the values for.


A named list of found and not found secrets. If a secret was not found, the corresponding element will be NULL.

See also