Get Service Retention

GET
/{{account-name}}/{{container-name}}?resource=filesystem&retention=retentionType

Summary

Retrieves the data retention policy for a Data Lake Storage Gen2 filesystem.

Request

This operation retrieves the data retention policy for a specified filesystem. It allows you to query how long data is retained for specific operations or the filesystem as a whole.

Path Parameters

Name Description Required
{{account-name}} The name of the storage account. Yes
{{container-name}} The name of the filesystem. Yes

Query Parameters

Name Description Type Required
resource Specifies the resource type. Must be set to filesystem for this operation. String Yes
retention Specifies the type of retention information to retrieve. Possible values are policy (for the general retention policy) or softdelete (for soft delete retention). String Yes
Authentication: This API requires authentication. Use Azure Active Directory (AAD) credentials or a Shared Access Signature (SAS) token with appropriate permissions.

Request Headers

Header Description Required
x-ms-version Specifies the version of the REST API to use for the request. Example: 2020-04-08. Yes
Authorization Contains the credentials for the request. Yes

Example Request

GET https://{{account-name}}.dfs.core.windows.net/{{container-name}}?resource=filesystem&retention=policy&x-ms-version=2020-04-08
Authorization: Bearer <your-access-token>

Response

Success (200 OK)
Error

200 OK

The request was successful and the retention policy information is returned.

Response Body

The response body contains a JSON object detailing the retention policy.

Example JSON Response (retention=policy)


{
  "retentionPolicy": {
    "enabled": true,
    "days": 30
  }
}
                            

Example JSON Response (retention=softdelete)


{
  "softDeleteRetentionPolicy": {
    "enabled": true,
    "retentionIntervalInDays": 7
  }
}
                            

Response Properties

For retention=policy:
  • retentionPolicy (object)
    • enabled (boolean): Indicates if the retention policy is enabled.
    • days (integer): The number of days data is retained.
For retention=softdelete:
  • softDeleteRetentionPolicy (object)
    • enabled (boolean): Indicates if the soft delete retention policy is enabled.
    • retentionIntervalInDays (integer): The number of days for soft delete retention.

Error Responses

This API can return standard Azure Storage error codes.

Code Description
InvalidQueryParameterValue The value for one of the query parameters is invalid.
InvalidHeaderValue The value for one of the request headers is invalid.
AuthenticationFailed The request did not specify valid credentials.
ResourceNotFound The specified filesystem or storage account does not exist.
Note: Detailed error responses typically include an XML or JSON body with an error code and message.