Troubleshooting Scripted Actions?

Does anyone have any great ways to troubleshoot scripted actions?

T.L.D.R: We're getting an error with a scripted action, but don't get the error when we run the same script in Azure or at the system level.



We wanted to take Tony's article (How to Use Azure Files with AADJ Method for AVD – Nerdio Help Center) and make it happen with Secure Variables instead of having storage account keys in clear text.
However, when we run the CMDKEY command, it's failing on that step when that command runs in a scripted action. When we run it in Azure (obviously without the secure variables) or in a system-level PowerShell window, it works correctly.

Error:
CMDKEY: This command requires either the /U switch and a username or else the /smartcard switch with a smartcard.

 
 
Scripted Action:

$storageAccount="$($SecureVars.FSLgxStorageAccount)"
$user="localhost\$($storageAccount)"
$secret="$SecureVars.FSLgxSecret"

cmdkey.exe /add:$($fileServer) /user:$($user) /pass:$($secret)

0

Comments (1 comment)

Avatar
DStephenson

I worked with support and found out we can see that the secure variables are showing correctly by using write-output and calling the variable.
(Example: Write-Output "Secure variable is $($SecureVars.FSLgxSecret)")

We were able to get the scripted action working with this command:

cmdkey.exe /add:$fileServer /user:localhost\$storageAccount /pass:$secret

0

Please sign in to leave a comment.