Create an action that accepts no inputs and returns the current user's SSH key based on the requester's username
Write it as javascript
var username = System.getContext().getParameter("__metadata_userName");
var sshKey = getSSHKeyForUser(username); // You must implement this
return sshKey;
Update your template yaml to use this action as default.
formatVersion: 1
inputs:
sshKey:
type: string
title: Clé SSH
$dynamicDefault: /data/vro-actions/com.xxxx/getSSHKeyForCurrentUser
readOnly: false
minLength: 32
maxLength: 9999
I havent tested it yet, but its a really interesting topic. I'll try it out soon to improve my understanding too
Original Message:
Sent: May 23, 2025 10:16 AM
From: websylv
Subject: Aria Automation get username
Hello,
I'm a new user of VMware Automation (8.18). I have spent hours searching for how to get the username of the user requesting a deployment during the request.
I would like to get the username to auto-fill an input with the SSH key of the user. I managed to get the SSH key, but I can't figure out how to pass the username to the action in the form or how to get the username in the Action.
Here is what I'm trying to do:
formatVersion: 1
inputs:
sshKey:
type: string
title: Clé SSH
$dynamicDefault: /data/vro-actions/com.xxxx/getSSHKeyPS?usernameInput=XXXXXXX
readOnly: false
minLength: 32
maxLength: 9999
Any ideas on how I can achieve this?