Create Backup Policy

Creates a backup policy.

Creates a backup policy which can be associated later with a Service Fabric application, service or a partition for periodic backup.

Request

Method Request URI
POST /BackupRestore/BackupPolicies/$/Create?api-version=6.4&timeout={timeout}&ValidateConnection={ValidateConnection}

Parameters

Name Type Required Location
api-version string Yes Query
timeout integer (int64) No Query
ValidateConnection boolean No Query
BackupPolicyDescription BackupPolicyDescription Yes Body

api-version

Type: string
Required: Yes
Default: 6.4

The version of the API. This parameter is required and its value must be '6.4'.

Service Fabric REST API version is based on the runtime version in which the API was introduced or was changed. Service Fabric runtime supports more than one version of the API. This version is the latest supported version of the API. If a lower API version is passed, the returned response may be different from the one documented in this specification.

Additionally the runtime accepts any version that is higher than the latest supported version up to the current version of the runtime. So if the latest API version is 6.0 and the runtime is 6.1, the runtime will accept version 6.1 for that API. However the behavior of the API will be as per the documented 6.0 version.


timeout

Type: integer (int64)
Required: No
Default: 60
InclusiveMaximum: 4294967295
InclusiveMinimum: 1

The server timeout for performing the operation in seconds. This timeout specifies the time duration that the client is willing to wait for the requested operation to complete. The default value for this parameter is 60 seconds.


ValidateConnection

Type: boolean
Required: No
Default: false

Specifies whether to validate the storage connection and credentials before creating or updating the backup policies.


BackupPolicyDescription

Type: BackupPolicyDescription
Required: Yes

Describes the backup policy.

Responses

HTTP Status Code Description Response Schema
201 (Created) A successful operation returns 201 status code and creates a new backup policy.
All other status codes The detailed error response.
FabricError

Examples

Create a time based backup policy with Azure as backup location

This example shows how to create a backup policy which takes backup twice everyday at 9 AM and 5 PM UTC which shall get deleted after 3 months, with Azure blob store as the backup location.

Request

POST http://localhost:19080/BackupRestore/BackupPolicies/$/Create?api-version=6.4
Body
{
  "Name": "DailyAzureBackupPolicy",
  "AutoRestoreOnDataLoss": false,
  "MaxIncrementalBackups": "3",
  "Schedule": {
    "ScheduleKind": "TimeBased",
    "ScheduleFrequencyType": "Daily",
    "RunTimes": [
      "0001-01-01T09:00:00Z",
      "0001-01-01T17:00:00Z"
    ]
  },
  "Storage": {
    "StorageKind": "AzureBlobStore",
    "FriendlyName": "Azure_storagesample",
    "ConnectionString": "DefaultEndpointsProtocol=https;AccountName=storagesample;AccountKey=<PutYourAccountKeyHere>",
    "ContainerName": "BackupContainer"
  },
  "RetentionPolicy": {
    "RetentionPolicyType": "Basic",
    "MinimumNumberOfBackups": "20",
    "RetentionDuration": "P3M"
  }
}

201 Response

Body

The response body is empty.

Create a time based backup policy with Azure as backup location accessed using managed identity

This example shows how to create a backup policy which takes backup twice everyday at 9 AM and 5 PM UTC which shall get deleted after 3 months, with Azure blob store as the backup location using managed identity.

Request

POST http://localhost:19080/BackupRestore/BackupPolicies/$/Create?api-version=6.4
Body
{
  "Name": "DailyAzureMIBackupPolicy",
  "AutoRestoreOnDataLoss": false,
  "MaxIncrementalBackups": "3",
  "Schedule": {
    "ScheduleKind": "TimeBased",
    "ScheduleFrequencyType": "Daily",
    "RunTimes": [
      "0001-01-01T09:00:00Z",
      "0001-01-01T17:00:00Z"
    ]
  },
  "Storage": {
    "StorageKind": "ManagedIdentityAzureBlobStore",
    "FriendlyName": "AzureMI_storagesample",
    "BlobServiceUri": "https://managedidentitytest.blob.core.windows.net/",
    "ContainerName": "BackupContainer",
    "ManagedIdentityType": "Cluster"
  },
  "RetentionPolicy": {
    "RetentionPolicyType": "Basic",
    "MinimumNumberOfBackups": "20",
    "RetentionDuration": "P3M"
  }
}

201 Response

Body

The response body is empty.

Create a frequency based backup policy with file share as backup location

This example shows how to create a backup policy which takes backup every 10 minutes which shall get deleted after 20 days, with file share as the backup location.

Request

POST http://localhost:19080/BackupRestore/BackupPolicies/$/Create?api-version=6.4
Body
{
  "Name": "FileShare10MinBackupPolicy",
  "AutoRestoreOnDataLoss": false,
  "MaxIncrementalBackups": "3",
  "Schedule": {
    "ScheduleKind": "FrequencyBased",
    "Interval": "PT10M"
  },
  "Storage": {
    "StorageKind": "FileShare",
    "FriendlyName": "FileShare_myshare",
    "Path": "\\\\myshare\\backupshare",
    "PrimaryUserName": "backupaccount",
    "PrimaryPassword": "abcd1234"
  },
  "RetentionPolicy": {
    "RetentionPolicyType": "Basic",
    "MinimumNumberOfBackups": "20",
    "RetentionDuration": "P20D"
  }
}

201 Response

Body

The response body is empty.

Create a time based backup policy with Dsms Azure as backup location

This example shows how to create a backup policy which takes backup twice everyday at 9 AM and 5 PM UTC which shall get deleted after 3 months, with Dsms Azure blob store as the backup location.

Request

POST http://localhost:19080/BackupRestore/BackupPolicies/$/Create?api-version=6.4
Body
{
  "Name": "SampleDsmsBackupPolicy",
  "AutoRestoreOnDataLoss": false,
  "MaxIncrementalBackups": "3",
  "Schedule": {
    "ScheduleKind": "TimeBased",
    "ScheduleFrequencyType": "Daily",
    "RunTimes": [
      "0001-01-01T09:00:00Z",
      "0001-01-01T17:00:00Z"
    ]
  },
  "Storage": {
    "StorageKind": "DsmsAzureBlobStore",
    "FriendlyName": "DsmsAzure_storagesample",
    "StorageCredentialsSourceLocation": "https://sample-dsms.dsms.core.winows.net/dsms/samplecredentiallocation/storageaccounts/samplestorageac/servicefabricbackup/samplebackup",
    "ContainerName": "BackupContainer"
  },
  "RetentionPolicy": {
    "RetentionPolicyType": "Basic",
    "MinimumNumberOfBackups": "20",
    "RetentionDuration": "P3M"
  }
}

201 Response

Body

The response body is empty.