How to store backups onto Azure Blob Storage?

Cataster 641 Reputation points
2021-08-26T02:44:14.033+00:00

I implemented log shipping using dbatools command: Invoke-DbaDbLogShipping

its working great, however, for that to work I had to map a shared drive due to the SharedPath parameter requirement.

Now that Im finished testing locally, I cant afford to use a mapped drive (my PC) as the backup for production databases. Instead, the recommendation going around is storing backups on Azure Blob Storage.

Is there a way to make Azure Blob Storage a shared path of some sort? Maybe data lake is more appropriate?

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,487 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,404 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Limitless Technology 39,426 Reputation points
    2021-08-26T10:08:32.17+00:00

    Hello Cataster,

    By now, Blob storage mounting as a file system is available as a preview in some sites: https://learn.microsoft.com/en-us/azure/storage/blobs/network-file-system-protocol-support-how-to?tabs=windows

    If you are using Azure Files, this could enable the mapping if requirements are met:
    https://learn.microsoft.com/en-us/azure/storage/files/storage-how-to-use-files-windows

    Alternatively there are other 3rd party solutions that can enable similar access like CloudBerry Drive for Microsoft Azure (it needs a license, but you can use the free trial version).

    On a more complex level, there is a script workaround for Blob but it is not officially supported, so chances that it will not fully work or have some issues are possible:

    Using Powershell the script below will map a blob storage to Z: with the drive label "Azure Blob Storage" You will need the location, the storage account name and access key.

    $connectTestResult = Test-NetConnection -ComputerName "BLOB STORAGE LOCATION HERE" -Port 445
    if ($connectTestResult.TcpTestSucceeded) {
    # Save the password so the drive will persist on reboot
    cmd.exe /C "cmdkey /add:"BLOB STORAGE LOCATION HERE" /user:"STORAGE ACCOUNT NAME HERE" /pass:"ACCESS KEY HERE""
    # Mount the drive
    New-PSDrive -Name Z -PSProvider FileSystem -Root "\BLOB STORAGE LOCATION HERE\FOLDER TO MAP" -Persist
    } else {
    Write-Error -Message "Unable to reach the Azure storage account via port 445. Check to make sure your organization or ISP is not blocking port 445, or use Azure P2S VPN, Azure S2S VPN, or Express Route to tunnel SMB traffic over a different port."
    }
    (New-Object -ComObject Shell.Application).NameSpace('Z:').Self.Name = 'Azure Blob Storage'

    --Do not forget to vote if helpful, or to mark as answer if it resolved your query.--

    Best regards!

    Luis P


  2. Cataster 641 Reputation points
    2021-08-26T21:44:09.147+00:00

    @Limitless Technology
    Luis thanks for your helpful post. Regarding the 1st link, it only describes mapping an Azure Blob Storage in linux. I am using windows machine.

    Regarding 3rd party suggestion, i dont think we are considering 3rd party solutions at this time, hence why we would like to make the Azure Blob Storage we have put to a good usecase like this.

    So i tried out the script you posted, and I got exception:

    Unable to reach the Azure storage account via port 445. Check to make sure your organization or ISP is not blocking port
    445, or use Azure P2S VPN, Azure S2S VPN, or Express Route to tunnel SMB traffic over a different port.

    I think i got the Azure storage location correctly, but can you confirm if thats the right way to get it?

    126877-image.png

    LSTest represents the FOLDER TO MAP parameter

    first thing i did is telnet to see if port is open:

    126896-image.png

    C:\Windows\system32>telnet https://analyticsdev.blob.core.windows.net/ 445  
    Connecting To https://analyticsdev.blob.core.windows.net/...Could not open connection to the host, on port 445: Connect failed  
    

    I also did nslookup, but it didnt find the storage location apparently

    How didnt it find it when clearly it exists?

    also telnet with address+port:

    C:\Windows\system32>nslookup https://analyticsdev.blob.core.windows.net/  
    Server:  XXXXX.attlocal.net  
    Address:  2600:...::1  
      
    *** XXXXX.attlocal.net can't find https://analyticsdev.blob.core.windows.net/: Non-existent domain  
    
    0 comments No comments