You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure SQL Server每日多次备份至Azure Blob配置咨询(CherrySafe替代)

Hey there! Let's break down how to set up daily (and multiple times a day) backups of your Azure SQL Database to Azure Blob Storage, since Cherry Safe is going away soon. I'll walk you through the steps and clear up the confusion about where to configure exports, plus clarify how this differs from long-term retention.

1. Why You Can't Find a "Scheduled Export" Option in the Portal

First off—you're not missing anything! The Azure Portal doesn't have a built-in, point-and-click option to schedule exports to Blob Storage directly from the SQL Database blade. Instead, you'll need to use automation tools to set this up, which gives you more control over how often backups run (perfect for multiple daily copies).

2. Step-by-Step: Set Up Scheduled Exports to Blob Storage

The most straightforward way for most teams is using Azure Automation Runbooks (PowerShell or Python) with a schedule. Here's how to do it:

Prerequisites

First, make sure you have these ready:

  • An Azure Automation Account (create one in the Portal if you don't have it)
  • A managed identity for your Automation Account with permissions to access your SQL Database and Blob Storage (grant SQL DB Contributor on the SQL Server and Storage Blob Data Contributor on the Storage Account)
  • A Blob Storage container (create one if you haven't already)

Step 1: Create a PowerShell Runbook

  1. Go to your Azure Automation Account → Runbooks → Create a runbook
  2. Name it something like Export-SqlDbToBlob, choose PowerShell as the runbook type, then click Create
  3. Paste this script (update the variables with your own details):
    # Update these variables with your Azure resources' details
    $resourceGroupName = "YourResourceGroupName"
    $sqlServerName = "YourSqlServerName"
    $databaseName = "YourDatabaseName"
    $storageAccountName = "YourStorageAccountName"
    $storageContainerName = "YourBlobContainerName"
    $backupFileName = "$databaseName-$(Get-Date -Format 'yyyyMMddHHmmss').bacpac"
    
    # Fetch storage account access key
    $storageKey = (Get-AzStorageAccountKey -ResourceGroupName $resourceGroupName -Name $storageAccountName).Value[0]
    
    # Export the database to Blob Storage as a BACPAC
    New-AzSqlDatabaseExport -ResourceGroupName $resourceGroupName `
        -ServerName $sqlServerName `
        -DatabaseName $databaseName `
        -StorageKeyType StorageAccessKey `
        -StorageKey $storageKey `
        -StorageUri "https://$storageAccountName.blob.core.windows.net/$storageContainerName/$backupFileName"
    
  4. Click Save, then Publish to make the runbook active

Step 2: Schedule the Runbook to Run Multiple Times a Day

  1. Open your published runbook → Schedules → Add a schedule
  2. Click Link a schedule to your runbook → Create a new schedule
  3. Configure the schedule:
    • Set your start time
    • Choose Recurring (instead of One-time)
    • Set the recurrence interval (e.g., every 4 hours for 6 daily backups, or every 6 hours for 4)
    • Set an end date if needed, or leave it as "No end date"
  4. Save the schedule, and your runbook will automatically export the database to Blob Storage on your chosen cadence.

Alternative: Use Azure Data Factory (If Your Team Uses It)

If your team already works with Azure Data Factory (ADF), you can set up a pipeline instead:

  • Create a new pipeline with a Copy Data activity
  • Source: Select Azure SQL Database, configure your connection
  • Sink: Select Azure Blob Storage, choose your container, and set a dynamic file name (e.g., @{pipeline().RunId}_database.bacpac or include timestamps)
  • Add a Recurrence Trigger to run the pipeline multiple times a day, then publish the pipeline.
3. Long-Term Retention (LTR) vs. Scheduled Exports

You mentioned seeing LTR options—let's clarify the difference so you know when to use each:

  • Long-Term Retention: This is Azure's built-in backup retention for SQL Databases. It automatically retains full backups for up to 10 years, but it's based on your database's existing backup chain (you can't trigger multiple daily backups with LTR). Also, LTR backups are stored in Azure's managed storage—you can't directly download them as BACPAC files (you'd need to restore the backup to a new database first, then export it).
  • Scheduled Exports: These generate standalone BACPAC files in your Blob Storage, which you can download, move to other regions, or use for migrations. This is the direct replacement for your Cherry Safe setup, since it gives you flexible, on-demand (or scheduled) backups you control.
4. Troubleshooting Tips
  • If the runbook fails, check the Logs tab in the runbook—this will show you exactly what went wrong (e.g., permission issues, connection problems, or a paused serverless database).
  • Double-check that your Automation Account's managed identity has the right permissions on both the SQL Server and Storage Account.
  • For serverless SQL Databases, make sure the database isn't paused when the runbook runs—you can set an "Always On" toggle or add a step to the script to resume the database before exporting.

内容的提问来源于stack exchange,提问作者AlterWorld

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 09:51:15