[Bug] Restore of database fails when original MDF location is on Azure Blob Storage
Describe the bug When trying to restore a BAK which had the original MDF File stored on Azure Blob Storage, the restore fails with an Filepath IO Error:
Error restoring database: Cannot convert value
"https://redacted.blob.core.windows.net/managedserver-redacted-ddö-ss/data/redactted-xxxx-999-9999-xxxxxx_1.mdf"
to type "System.IO.FileInfo". Error: "The given path's format is not
supported.".
my Restore module looks like this:
- name: Restore Database
lowlydba.sqlserver.restore:
sql_instance: "{{ dst_host }}"
sql_username: "sa"
sql_password: "{{ sa_login_pw }}"
database: "{{ db_name }}"
path: "{{ restore_path }}/{{ src_bak_name }}"
use_destination_default_directories: true
replace_db_name_in_file: true
verify_only: false
with_replace: false
The Restore of the same file works well with SSMS.
To Reproduce Restore any bak File which has the original mdf on azure blob storage.
Expected behavior Restore completed successfully
Hi @tovoro,
Thanks for opening an issue! That is not a supported feature at this time, unfortunately. I also don't have access to an Azure account right now, so probably won't be able to build and test that sort of thing.
The good news is: the restore module basically just implements dbatools' Restore-DbaDatabase command, which does support that! If you wanted to implement that new functionality into the existing restore module of this collection - it should be fairly straightforward - I'm happy to review a PR for it.