PowerShell script exchange
Post Reply
anthonyspiteri79
Veeam Software
Posts: 741
Liked: 207 times
Joined: Jan 14, 2016 6:48 am
Full Name: Anthony Spiteri
Location: Perth, Australia
Contact:

Unable to add Key Based credential for Linux

Post by anthonyspiteri79 »

I'm trying to add a Linux server which is on AWS to be a repo...I need to use key based authentication.

https://anthonyspiteri.net/quick-post-c ... epository/

Works no problems from the Console as per the blog above. However getting this error when trying to add it via PowerShell.

Code: Select all

PS C:\Users\adm.anthony.spiteri\Downloads> $LinuxKey="C:\Users\adm.anthony.spiteri\Downloads\KEY-VEEAM-03.pem"
PS C:\Users\adm.anthony.spiteri\Downloads> Add-VBRCredentials -Type LinuxPubKey -User $LinuxUsername -PrivateKeyPath $LinuxKey

cmdlet Add-VBRCredentials at command pipeline position 1
Supply values for the following parameters:
Password:
Add-VBRCredentials : The type initializer for 'Veeam.Backup.Common.RuntimeApplication' threw an exception.
At line:1 char:1
+ Add-VBRCredentials -Type LinuxPubKey -User $LinuxUsername -ElevateToR ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Add-VBRCredentials], TypeInitializationException
    + FullyQualifiedErrorId : System.TypeInitializationException,Veeam.Backup.PowerShell.Cmdlets.AddVBRCredentials
ref:_00D30RWR._5000e1Miy37:ref
Anthony Spiteri
Regional CTO APJ & Lead Cloud and Service Provider Technologist
Email: anthony.spiteri@veeam.com
Twitter: @anthonyspiteri
tsightler
VP, Product Management
Posts: 6012
Liked: 2843 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: Unable to add Key Based credential for Linux

Post by tsightler » 1 person likes this post

Hi Anthony. I don't have any issue adding Linux public key credentials via Add-VBRCredentials. The only think that jumps out to me is that I believe "-Password" is required, so if your PEM file is not encrypted then you should use -Password "". That being said, it kinda seems like the error you posted is from a different command as I see -ElevateToR... in the line.

I just ran this on my U3a instance and it worked just fine:

Code: Select all

$LinuxKey="C:\Users\notyouradmin\Documents\SSH Keys\veeamagent.pem"
Add-VBRCredentials -Type LinuxPubKey -User "deleteme" -Password "" -PrivateKeyPath $LinuxKey
Does your PEM file have both public and private key in it? Perhaps that's tripping up the Powershell, I haven't tested that yet.
anthonyspiteri79
Veeam Software
Posts: 741
Liked: 207 times
Joined: Jan 14, 2016 6:48 am
Full Name: Anthony Spiteri
Location: Perth, Australia
Contact:

Re: Unable to add Key Based credential for Linux

Post by anthonyspiteri79 »

Got it working...on 3a.

My testing was on the U4 BETA! That's throwing the exception. Didn't think to try a normal GA build.
Anthony Spiteri
Regional CTO APJ & Lead Cloud and Service Provider Technologist
Email: anthony.spiteri@veeam.com
Twitter: @anthonyspiteri
Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests