PowerShell script exchange
Post Reply
matteu
Veeam Legend
Posts: 823
Liked: 128 times
Joined: May 11, 2018 8:42 am
Contact:

Get access key from S3 repository

Post by matteu »

Hello,

I'm trying to get the Access key associated with my repository but I don't find how to do.

I find the cmdlet Get-VBRAmazonAccount to get all my amazon access key and the cmdlet Get-VBRObjectStorageRepository to get my repository object however I don't find anything on the repository to know what is the ID of the access key.

Thanks for your help.
david.domask
Veeam Software
Posts: 2123
Liked: 513 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Get access key from S3 repository

Post by david.domask »

Hi matteu,

I'm afraid I don't see a way to link this right now with supported means :/ Let's consider this an area for improvement for future releases, will discuss it with the responsible team. As a workaround for now, you can use the following unsupported method, with the usual caveats about unsupported methods :)

Pass the Id returned from Get-VBRObjectStorageRepository to [Veeam.Backup.Core.CBackupRepository]::Find() like below. The resulting object will have a property Credentials which tells what you need.

It is important that you do not attempt to pass the objects returned from CBackupRepository to other cmdlets to perform operations using this object This must be for reporting only. Only make changes to the environment using official cmdlets to retrieve and make changes to your environment.

Code: Select all

$repos = Get-VBRObjectStorageRepository
Foreach($r in $repos){
     $objstgRepo = [Veeam.Backup.Core.CBackupRepository]::Find($r.id)
     $objstgcreds = $objstgRepo.Credentials
}
David Domask | Product Management: Principal Analyst
vitalii.fesh
Influencer
Posts: 11
Liked: 4 times
Joined: May 29, 2024 2:47 pm
Full Name: Vitalii Feshchenko
Contact:

Re: Get access key from S3 repository

Post by vitalii.fesh »

Would this work?

$repositories = Get-VBRBackupRepository
$repositories.Credentials.AccessKey

P.S. I dont have AWS to test it, but it works with my local S3.
david.domask
Veeam Software
Posts: 2123
Liked: 513 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Get access key from S3 repository

Post by david.domask » 1 person likes this post

Hi Vitalii,

In part you are correct, but the note on Get-VBRBackupRepository instructs that you use Get-VBRObjectStorageRepository to retrieve information on Object Storage Repositories, and a quick test shows that there is a difference in the returned values, so I recommend use the workaround for now:

Code: Select all

PS C:\Users\david.LAB> $orepos = Get-VBRObjectStorageRepository
PS C:\Users\david.LAB> $allOSRepos = Get-VBRBackupRepository | Where-Object {$_.id -in $orepos.id}
PS C:\Users\david.LAB> $allOSRepos.Count
15
PS C:\Users\david.LAB> $orepos.count
28
Just it looks like you'll miss some items going through Get-VBRBackupRepository.
David Domask | Product Management: Principal Analyst
matteu
Veeam Legend
Posts: 823
Liked: 128 times
Joined: May 11, 2018 8:42 am
Contact:

Re: Get access key from S3 repository

Post by matteu »

It s working fine thank you :)
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests