I have been using service account credentials with Google drive and rclone for some time. However it has gotten to the point where I need to dynamically pass the credentials in to some of our scripting for better security and flexibility. I have been attempting this for a few hours and not gotten anywhere trying to pass the json blob in to the command and it accept it always errors with this.
"Usage:
rclone lsd remote:path [flags]
Command lsd needs 1 arguments maximum: you provided 5 non flag arguments:
"
I am working in powershell core v6.1.1 on Windows.
I am testing on the latest beta build. rclone: Version “v1.47.0-002-gf5795db6-beta”
It is execting a single string with a JSON blob inside it.
That makes me think that there is a problem passing the string. It has " in it if I remember rightly. Not a powershell expert, but if this was bash I'd use the alternate delimiters ' instead of " to fix that. A bit of googling leads be to believe that will work with powershell too.
You can also set an environment variable RCLONE_DRIVE_SERVICE_ACCOUNT_CREDENTIALS if that is easier.
The Error:
"Command lsd needs 1 arguments maximum: you provided 5 non flag arguments: [":drive:test" "PRIVATE" "KEY-----\n"
I think the spaces within the the quoted values in the json blob is what rclone is having issues with now. It doesn't have any issues with any of the content before that in the blob.
Strange... It is powershell doing the chunking into arguments and rclone is just reporting what it was given, so the solution to this lies within powershell somewhere!