Sql-server – Restore Latest Copy of Full and Differential database From Azure Blob Container

azurepowershellrestoresql server

I'm trying to work out how to Restore the Latest Backup of a Database that is held on Azure Storage Blobs. This container contains other backups from different databases on a server but I'm only interested in Restoring the Latest Full and Diff Backup for a particular Database

I need to do this automatically via powershell or something and schedule it from a job.

I've looked at:
Restore-SqlDatabase but can't see how it will use Azure credentials
DBATools.io – Again nothing to pass in Azure credentials
AzCopy – How do you get the latest Backup?
Azure PowerShell – Again as above.

Any pointers would be greatly appreciated.

Thanks In Advance.

Best Answer

Restore-DbaDatabase does have -AzureCredential as parameter.

Suggest you to download the latest version of dbatools and try it.

Alternatively, you can try ps_restoregene - which is powershell based script written by Paul brewer. (I have used it and its a life saver :-) )