本文說明如何使用 REST API 建立 備份保存庫 。 您也可以 使用 Azure 入口網站建立備份保存庫。
Azure 備份的新資料保護平台可提供備份的增強功能,並針對較新的工作區提供還原功能,例如儲存體帳戶中的 Blob、受管理磁碟和 PostgreSQL 伺服器的 PaaS 平台。 此目的是要將管理額外負荷盡可能降低,同時讓組織備份更為輕鬆。 「備份保存庫」是資料保護平台的基石,與「復原服務」保存庫不同。
建立保存庫 REST API 文件中概述使用 REST API 建立 Azure 備份服務保存庫的步驟。 讓我們使用本文件作為參考,在 West US 中及 TestBkpVaultRG 資源群組下方建立一個名為 testBkpVault 的保存庫。
若要建立或更新 Azure 備份保存庫,請使用下列 PUT 作業。
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/testBkpVault?api-version=2021-01-01
建立要求
若要建立 PUT 要求,{subscription-id} 是必要參數。 如果您有多個訂用帳戶,請參閱使用多個訂用帳戶。 您需針對資源定義 {resourceGroupName} 和 {vaultName},以及定義 api-version 參數。 本文使用 api-version=2021-01-01。
以下是必要標頭:
| 要求標頭 | 描述 |
|---|---|
| Content-Type: | 必要。 設定為 application/json。 |
| 授權: | 必要。 設定為無效的 Bearer存取權杖。 |
如需如何建立要求的詳細資訊,請參閱 REST API 要求/回應的元件。
建立要求本文
以下是用來建立要求本文的常用定義:
| 名稱 | 必要 | 類型 | 描述 |
|---|---|---|---|
| etag | 繩子 | 選擇性 eTag | |
| 位置 | 是 | 繩子 | 資源位置 |
| properties | 是 | BackupVault | 保存庫的屬性 |
| 身分識別 | DPPIdentityDetails | 識別每個 Azure 資源的唯一系統識別碼 | |
| tags | 物體 | 資源標籤 |
請注意,保存庫名稱和資源群組名稱會在 PUT URI 中提供。 要求本文會定義位置。
要求本文範例
下列範例本文用於在美國西部建立保存庫。 指定位置。
{
"location": "WestUS",
"tags": {
"key1": "val1"
},
"identity": {
"type": "None"
},
"properties": {
"storageSettings": [
{
"datastoreType": "VaultStore",
"type": "LocallyRedundant"
}
]
}
}
如果您想要建立備份保存庫,並同時產生系統指派的身分識別,則您應指定下列要求本文。
{
"location": "WestUS",
"tags": {
"key1": "val1"
},
"identity": {
"type": "systemAssigned"
},
"properties": {
"storageSettings": [
{
"datastoreType": "VaultStore",
"type": "LocallyRedundant"
}
]
}
}
回應
建立備份保存庫為非同步作業。 這表示此作業會建立另一項需要個別追蹤的作業。 建立或更新備份保存庫的作業會有兩個成功的回應:
| 名稱 | 類型 | 描述 |
|---|---|---|
| 200 確定 | BackupVaultResource | [確定] |
| 201 Created | BackupVaultResource | 建立時間 |
| 其他狀態碼 | CloudError |
如需 REST API 回應的詳細資訊,請參閱處理回應訊息。
範例回應
先前範例要求本文所傳回的扼要 201 Created 回應會顯示已指派 id,且 provisioningState 為 Succeeded:
{
"eTag": null,
"id": "/subscriptions/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/TestBkpVaultRG/providers/Microsoft.DataProtection/BackupVaults/testBkpVault",
"identity": {
"principalId": "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"tenantId": "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"type": "SystemAssigned"
},
"location": "westUS",
"name": "testBkpVault",
"properties": {
"provisioningState": "Succeeded",
"storageSettings": [
{
"datastoreType": "VaultStore",
"type": "GeoRedundant"
}
]
},
"resourceGroup": "TestBkpVaultRG",
"systemData": null,
"tags": {},
"type": "Microsoft.DataProtection/backupVaults"
}
後續步驟
如需 Azure REST API 的詳細資訊,請參閱下列文件:
- Azure 資料保護提供者 REST API
- Get started with Azure REST API (開始使用 Azure REST API)