共用方式為


快速入門:建立 Azure Data Lake Storage 的保存庫備份原則

此快速入門描述如何從 Azure 入口網站為 Azure Data Lake Storage 建立封存備份策略。

先決條件

在您建立 Azure Data Lake Storage 的保險庫備份政策之前,請確定符合下列前提條件:

  • 識別或 建立備份保存庫 以設定 Azure Data Lake Storage 備份。
  • 檢閱 Azure Data Lake Storage 備份支援的 案例

使用 Azure 入口網站設定 Azure Data Lake Storage 的保存庫備份原則

備份原則會定義備份 Azure Data Lake Storage 的排程和頻率。 您可以從備份保存庫建立備份原則,或在備份組態期間隨時隨地建立備份原則。

若要從備份保存庫設定 Azure Data Lake Storage 的保存庫備份原則,請遵循下列步驟:

  1. Azure 入口網站中,移至 [備份保存庫>備份原則],然後選取 [+ 新增]。

  2. 在 [ 建立備份原則] 窗格的 [基本] 索引標籤上,在 原則名稱上提供新原則的名稱,然後選取 [ 資料來源類型 ] 作為 [Azure Data Lake Storage]。

    顯示如何開始建立備份原則的螢幕快照。

  3. [排程 + 保留] 索引標籤的 [ 備份排程 ] 區段下,將 [備份頻率 ] 設定為 [每日 ] 或 [每週] ,以及建立備份復原點的排程。

  4. 在 [ 新增保留] 區段下,編輯預設保留規則或新增規則,以指定復原點的保留。

  5. 選擇 檢閱 + 創建

  6. 審核成功之後,選擇 [建立]。

本快速入門說明如何使用 PowerShell 為 Azure Data Lake Storage 備份 建立彙集備份策略。

先決條件

在建立 Azure Data Lake Storage 的加密備份原則之前,請確定符合下列必要條件:

使用 PowerShell 為 Azure Data Lake Storage 設定保管庫備份策略

若要設定 Azure Data Lake Storage 的保存庫備份原則,請執行下列 Cmdlet:

  1. 若要擷取原則範本,請使用 Get-AzDataProtectionPolicyTemplate Cmdlet。 此命令會擷取指定資料來源類型的預設原則範本。 使用此原則範本來建立新的原則。

    $defaultPol = Get-AzDataProtectionPolicyTemplate -DatasourceType AzureDataLakeStorage
    
  2. 若要建立保存庫備份原則,請定義備份的排程和保留期。 下列範例 Cmdlet 會建立一個備份策略,設定備份頻率為每週二及週五上午 10 點,並保留三個月。

    $schDates = @(
    (
    (Get-Date -Year 2023 -Month 08 -Day 18 -Hour 10 -Minute 0 -Second 0)
    ),
    (
    (Get-Date -Year 2023 -Month 08 -Day 22 -Hour 10 -Minute 0 -Second 0)
    ))
    $trigger =  New-AzDataProtectionPolicyTriggerScheduleClientObject -ScheduleDays $schDates -IntervalType Weekly -IntervalCount 1
    Edit-AzDataProtectionPolicyTriggerClientObject -Schedule $trigger -Policy $defaultPol
    
    $lifeCycleVault = New-AzDataProtectionRetentionLifeCycleClientObject -SourceDataStore VaultStore -SourceRetentionDurationType Months -SourceRetentionDurationCount 3
    Edit-AzDataProtectionPolicyRetentionRuleClientObject -Policy $defaultPol -Name Default -LifeCycles $lifeCycleVault -IsDefault $true
    New-AzDataProtectionBackupPolicy -SubscriptionId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -ResourceGroupName "resourceGroupName" -VaultName "vaultName" -Name "MyPolicy" -Policy $defaultPol
    
    

本快速入門說明如何使用 Azure CLI,為 Azure Data Lake Storage 備份建立保存庫備份原則。

先決條件

建立 Azure Data Lake Storage 的保存庫備份原則之前,請確保符合下列先決條件:

  • 識別或 建立備份保存庫 以設定 Azure Data Lake Storage 備份。
  • 檢閱 Azure Data Lake Storage 備份支援的 案例

使用 Azure CLI 設定 Azure Data Lake Storage 的安全備份政策

若要設定 Azure Date Lake Storage 備份的保存庫備份原則,請執行下列命令:

這很重要

備份排程遵循 ISO 8601 持續時間格式。 不過,不支援重複間隔前置詞 R ,因為備份會設定為無限期執行。 指定了 R 的任何值都會被忽略。

  1. 若要瞭解 Azure Data Lake Storage 備份的備份原則元件,請使用命令 az dataprotection backup-policy get-default-policy-template 擷取原則範本。 下列命令會傳回指定資料來源類型的預設原則範本,您可以使用該範本來建立新原則。

    az dataprotection backup-policy get-default-policy-template --datasource-type AzureDataLakeStorage > policy.json
    
  2. 儲存包含所有必要值的原則 JSON 之後,請繼續使用命令 az dataprotection backup-policy create 從原則物件建立新的原則。

    Az dataprotection backup-policy create -g adlsrg –vault-name TestBkpVault -n AdlsPolicy1  –policy policy.json
    

    下列範例 JSON 被定義為將封存備份的原則設定為預設的保留期限為30天。 保存庫備份會排程為國際標準時間每天 7:30。

    {
       "properties": {
          "policyRules": [
                {
                   "lifecycles": [
                      {
                            "deleteAfter": {
                               "objectType": "AbsoluteDeleteOption",
                               "duration": "P30D"
                            },
                            "targetDataStoreCopySettings": [],
                            "sourceDataStore": {
                               "dataStoreType": "VaultStore",
                               "objectType": "DataStoreInfoBase"
                            }
                      }
                   ],
                   "isDefault": true,
                   "name": "Default",
                   "objectType": "AzureRetentionRule"
                },
                {
                   "backupParameters": {
                      "backupType": "Discrete",
                      "objectType": "AzureBackupParams"
                   },
                   "trigger": {
                      "schedule": {
                            "repeatingTimeIntervals": [
                               "R/2025-10-13T07:00:00+00:00/P1D"
                            ],
                            "timeZone": "Coordinated Universal Time"
                      },
                      "taggingCriteria": [
                            {
                               "tagInfo": {
                                  "tagName": "Default",
                                  "id": "Default_"
                               },
                               "taggingPriority": 99,
                               "isDefault": true
                            }
                      ],
                      "objectType": "ScheduleBasedTriggerContext"
                   },
                   "dataStore": {
                      "dataStoreType": "VaultStore",
                      "objectType": "DataStoreInfoBase"
                   },
                   "name": "BackupDaily",
                   "objectType": "AzureBackupRule"
                }
          ],
          "datasourceTypes": [
                "Microsoft.Storage/storageAccounts/adlsBlobServices"
          ],
          "objectType": "BackupPolicy"
       },
       "id": "/subscriptions/ xxxxxxxx-xxxx-xxxx-xxxx /resourceGroups/ adlsrg/providers/Microsoft.DataProtection/backupVaults/ TestBkpVault/backupPolicies/AdlsPolicy1",
       "name": "AdlsPolicy1",
       "type": "Microsoft.DataProtection/backupVaults/backupPolicies"
    }
    

後續步驟