Azure BLOB storage for SharePoint online

Daniel Maier 31 Reputation points
2022-08-26T00:35:49.003+00:00

Hello

I would like to use Azure BLOB storage for my SharePoint online. Is it possible to use BLOB storage space to store SharePoint online documents?
How can I do that?

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
11,176 questions
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. Xuyan Ding - MSFT 7,586 Reputation points
    2022-08-26T03:10:02.237+00:00

    Hi @Daniel Maier

    1.We can copy documents from SharePoint Online to Azure Blob Storage using Power Automate. There is a template in Power Automate called "Copy files from a SharePoint folder to a AzureBlob folder", which can copy from a shared folder in SharePoint Online to Azure storage by executing a simple flow.
    235103-image.png

    2.This PowerShell script shows how to download and sync documents in a SharePoint Document Library into an Azure Storage Container using CLI for Microsoft 365 and Azure CLI commands.

     $spolHostName = "https://tenant-name.sharepoint.com"  
     $spolSiteRelativeUrl = "/sites/site-name"  
     $spolDocLibTitle = "document-library-title"  
     $azStorageAccountKey = "*****************"  
     $azStorageAccountName = "azure-storage-account-name"  
     $azStorageContainerName = "azure-storage-container-name"  
     $localBaseFolderName = "local-base-folder-name"  
    
     $localFileDownloadFolderPath = $PSScriptRoot  
     $spolSiteUrl = $spolHostName + $spolSiteRelativeUrl  
    
     $spolLibItems = m365 spo listitem list --webUrl $spolSiteUrl --title   
     $spolDocLibTitle --fields 'FileRef,FileLeafRef' --filter "FSObjType eq 0" -o json | ConvertFrom-Json  
    
     if ($spolLibItems.Count -gt 0) {  
       ForEach ($spolLibItem in $spolLibItems) {  
         $spolLibFileRelativeUrl = $spolLibItem.FileRef  
         $spolFileName = $spolLibItem.FileLeafRef  
    
         $spolLibFolderRelativeUrl = $spolLibFileRelativeUrl.Substring(0, $spolLibFileRelativeUrl.lastIndexOf('/'))  
    
     $localDownloadFolderPath = Join-Path $localFileDownloadFolderPath $localBaseFolderName $spolLibFolderRelativeUrl  
    
     If (!(test-path $localDownloadFolderPath)) {  
       $message = "Target local folder $localDownloadFolderPath not exist"  
       Write-Host $message -ForegroundColor Yellow  
    
       New-Item -ItemType Directory -Force -Path $localDownloadFolderPath | Out-Null  
    
       $message = "Created target local folder at $localDownloadFolderPath"  
       Write-Host $message -ForegroundColor Green  
     }  
     else {  
       $message = "Target local folder exist at $localDownloadFolderPath"  
       Write-Host $message -ForegroundColor Blue  
     }  
    
     $localFilePath = Join-Path $localDownloadFolderPath $spolFileName  
    
     $message = "Processing SharePoint file $spolFileName"  
     Write-Host $message -ForegroundColor Green  
    
     m365 spo file get --webUrl $spolSiteUrl --url $spolLibFileRelativeUrl --asFile --path $localFilePath  
    
     $message = "Downloaded SharePoint file at $localFilePath"  
     Write-Host $message -ForegroundColor Green  
       }  
    
       $localFolderToSync = Join-Path $localFileDownloadFolderPath   
     $localBaseFolderName  
       az storage blob sync --account-key $azStorageAccountKey --account-name $azStorageAccountName -c $azStorageContainerName -s $localFolderToSync --only-show-errors | Out-Null  
    
       $message = "Syncing local folder $localFolderToSync with Azure Storage Container $azStorageContainerName is completed"  
       Write-Host $message -ForegroundColor Green  
     }  
     else {  
       Write-Host "No files in $spolDocLibTitle library" -ForegroundColor Yellow  
     }  
    

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    2 people found this answer helpful.

  2. Jose A 1 Reputation point
    2022-08-29T04:20:08.227+00:00

    Hi @Xuyan Ding - MSFT , thanks for the reply. your recommended solution is for the newly created files, right? this flow doesn't move already existing files in SPO. how to migrate (one-off) the SharePoint Online Folders already existed in SharePoint online to Azure Blob/FileShare (Cool tier) to archive and free up the SharePoint online limited storage. please advise


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.