Share via


Retention Policies - Create Or Replace

Create or Update a Retention Policy

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/retentionPolicies/default?api-version=2025-04-01-preview

URI Parameters

Name In Required Type Description
resourceGroupName
path True

string

minLength: 1
maxLength: 90

The name of the resource group. The name is case insensitive.

schedulerName
path True

string

pattern: ^[a-zA-Z0-9-]{3,64}$

The name of the Scheduler

subscriptionId
path True

string (uuid)

The ID of the target subscription. The value must be an UUID.

api-version
query True

string

minLength: 1

The API version to use for this operation.

Request Body

Name Type Description
properties

RetentionPolicyProperties

The resource-specific properties for this resource.

Responses

Name Type Description
200 OK

RetentionPolicy

Resource 'RetentionPolicy' update operation succeeded

201 Created

RetentionPolicy

Resource 'RetentionPolicy' create operation succeeded

Headers

  • Azure-AsyncOperation: string
  • Retry-After: integer
Other Status Codes

ErrorResponse

Validation error: required parameters are missing

Security

azure_auth

Azure Active Directory OAuth2 Flow.

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

RetentionPolicies_CreateOrReplace_MaximumSet

Sample request

PUT https://management.azure.com/subscriptions/194D3C1E-462F-4738-9025-092A628C06EB/resourceGroups/rgdurabletask/providers/Microsoft.DurableTask/schedulers/testscheduler/retentionPolicies/default?api-version=2025-04-01-preview

{
  "properties": {
    "retentionPolicies": [
      {
        "retentionPeriodInDays": 30
      },
      {
        "retentionPeriodInDays": 10,
        "orchestrationState": "Failed"
      }
    ]
  }
}

Sample response

{
  "properties": {
    "provisioningState": "Succeeded",
    "retentionPolicies": [
      {
        "retentionPeriodInDays": 30
      },
      {
        "retentionPeriodInDays": 10,
        "orchestrationState": "Failed"
      }
    ]
  },
  "id": "/subscriptions/194D3C1E-462F-4738-9025-092A628C06EB/resourceGroups/rgdurabletask/providers/Microsoft.DurableTask/schedulers/testscheduler/retentionPolicies/default",
  "name": "default",
  "type": "Microsoft.DurableTask/schedulers/retentionPolicies",
  "systemData": {
    "createdBy": "zshkmc",
    "createdByType": "User",
    "createdAt": "2025-03-31T23:34:09.612Z",
    "lastModifiedBy": "ivqrae",
    "lastModifiedByType": "User",
    "lastModifiedAt": "2025-03-31T23:34:09.612Z"
  }
}
Azure-AsyncOperation: https://contoso.com/operationstatus
{
  "properties": {
    "provisioningState": "Succeeded",
    "retentionPolicies": [
      {
        "retentionPeriodInDays": 30
      },
      {
        "retentionPeriodInDays": 10,
        "orchestrationState": "Failed"
      }
    ]
  },
  "id": "/subscriptions/194D3C1E-462F-4738-9025-092A628C06EB/resourceGroups/rgdurabletask/providers/Microsoft.DurableTask/schedulers/testscheduler/retentionPolicies/default",
  "name": "default",
  "type": "Microsoft.DurableTask/schedulers/retentionPolicies",
  "systemData": {
    "createdBy": "zshkmc",
    "createdByType": "User",
    "createdAt": "2025-03-31T23:34:09.612Z",
    "lastModifiedBy": "ivqrae",
    "lastModifiedByType": "User",
    "lastModifiedAt": "2025-03-31T23:34:09.612Z"
  }
}

Definitions

Name Description
createdByType

The type of identity that created the resource.

ErrorAdditionalInfo

The resource management error additional info.

ErrorDetail

The error detail.

ErrorResponse

Error response

ProvisioningState

The status of the current operation

PurgeableOrchestrationState

Purgeable orchestration state to be used in retention policies

RetentionPolicy

A retention policy resource belonging to the scheduler

RetentionPolicyDetails

The properties of a retention policy

RetentionPolicyProperties

The retention policy settings for the resource

systemData

Metadata pertaining to creation and last modification of the resource.

createdByType

The type of identity that created the resource.

Value Description
User
Application
ManagedIdentity
Key

ErrorAdditionalInfo

The resource management error additional info.

Name Type Description
info

object

The additional info.

type

string

The additional info type.

ErrorDetail

The error detail.

Name Type Description
additionalInfo

ErrorAdditionalInfo[]

The error additional info.

code

string

The error code.

details

ErrorDetail[]

The error details.

message

string

The error message.

target

string

The error target.

ErrorResponse

Error response

Name Type Description
error

ErrorDetail

The error object.

ProvisioningState

The status of the current operation

Value Description
Succeeded

Resource has been created.

Failed

Resource creation failed.

Canceled

Resource creation was canceled.

Provisioning

The resource is being provisioned

Updating

The resource is updating

Deleting

The resource is being deleted

Accepted

The resource create request has been accepted

PurgeableOrchestrationState

Purgeable orchestration state to be used in retention policies

Value Description
Completed

The orchestration is completed

Failed

The orchestration is failed

Terminated

The orchestration is terminated

Canceled

The orchestration is canceled

RetentionPolicy

A retention policy resource belonging to the scheduler

Name Type Description
id

string (arm-id)

Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"

name

string

The name of the resource

properties

RetentionPolicyProperties

The resource-specific properties for this resource.

systemData

systemData

Azure Resource Manager metadata containing createdBy and modifiedBy information.

type

string

The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"

RetentionPolicyDetails

The properties of a retention policy

Name Type Description
orchestrationState

PurgeableOrchestrationState

The orchestration state to which this policy applies. If omitted, the policy applies to all purgeable orchestration states.

retentionPeriodInDays

integer (int32)

The retention period in days after which the orchestration will be purged automatically

RetentionPolicyProperties

The retention policy settings for the resource

Name Type Description
provisioningState

ProvisioningState

The status of the last operation

retentionPolicies

RetentionPolicyDetails[]

The orchestration retention policies

systemData

Metadata pertaining to creation and last modification of the resource.

Name Type Description
createdAt

string (date-time)

The timestamp of resource creation (UTC).

createdBy

string

The identity that created the resource.

createdByType

createdByType

The type of identity that created the resource.

lastModifiedAt

string (date-time)

The timestamp of resource last modification (UTC)

lastModifiedBy

string

The identity that last modified the resource.

lastModifiedByType

createdByType

The type of identity that last modified the resource.