PowerShell script exchange
Post Reply
Rmachado
Service Provider
Posts: 23
Liked: 4 times
Joined: Dec 15, 2016 11:39 pm
Contact:

Restore-VESQLDatabase and SqlCredentials - not using job credentials

Post by Rmachado »

Hello everyone.
i´m using the Restore-VESQLDatabase without any issue with a working script with a user with admin permission. The problems comes with SQLCredentials when i try to put as a post script in a job , that according to the doc "https://helpcenter.veeam.com/docs/backu ... ml?ver=120" it says : Specifies SQL credentials for authenticating to Microsoft SQL Server.
Note: If you do not specify SQL credentials, the cmdlet will use current account credentials. If these credentials do not work, the cmdlet will use the credentials specified in the backup job.

Well, the thing is, it does not use the credentials specified in the backup job as a failover if the current account does not work. In my tests, it´s using the account in the services.msc and not the credentials in a job.

Im missing something?

Thanks!
david.domask
Veeam Software
Posts: 1226
Liked: 323 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Restore-VESQLDatabase and SqlCredentials - not using job credentials

Post by david.domask »

@Rmachado,

https://helpcenter.veeam.com/docs/backu ... ml?ver=120

If it's a PostJob script, the account used to run the script is the service account as noted in the link above (see the blue info box):

>To run the script, Veeam Backup & Replication uses the Service Account under which the Veeam Backup Service is running.

So that's why it's defaulting to the service account when using it as a PostJob Script.

A simple way I can think to work around this is store the credentials in an encrypted file that the service account can access, and then load the credentials that way, or use a different service account for the Backup Service, but I don't recommend changing from the SYSTEM account for the Backup Service.
David Domask | Product Management: Principal Analyst
Rmachado
Service Provider
Posts: 23
Liked: 4 times
Joined: Dec 15, 2016 11:39 pm
Contact:

Re: Restore-VESQLDatabase and SqlCredentials - not using job credentials

Post by Rmachado »

Hello friend.

Thank you for the response.

Guess we will evaluate the two options! Thanks again!
david.domask
Veeam Software
Posts: 1226
Liked: 323 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Restore-VESQLDatabase and SqlCredentials - not using job credentials

Post by david.domask »

Hi @Rmachado you're very welcome, I'm glad I could shed some light. If you don't mind, can you explain the business logic for your scripting here? As I get it, you run this after some job and then restore some database that was backed up in the job? Just looking to see if there are ways to make this easier for you.
David Domask | Product Management: Principal Analyst
Rmachado
Service Provider
Posts: 23
Liked: 4 times
Joined: Dec 15, 2016 11:39 pm
Contact:

Re: Restore-VESQLDatabase and SqlCredentials - not using job credentials

Post by Rmachado »

Sure.

I have some costumers that need to restore daily database backups to another sql for testing/development purposes
david.domask
Veeam Software
Posts: 1226
Liked: 323 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Restore-VESQLDatabase and SqlCredentials - not using job credentials

Post by david.domask »

Aha, that part is clear :) I guess question is more is it essential to run as a Post-Job script? That is the only element of your plan that causes this nuance, so just curious if PostJob is essential for for this workflow.
David Domask | Product Management: Principal Analyst
Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests