Edit

Share via


OneLake Settings - Modify Immutability Policy

Create or update OneLake immutability settings.
Set immutability policy for data stored in OneLake. Currently, this feature supports configuring a retention period specifically for diagnostic logs within a workspace, ensuring they remain unaltered once written.

Permissions

The caller must have an admin workspace role.

Required Delegated Scopes

OneLake.ReadWrite.All

Limitations

Can be applied only if:

  • The current workspace is storing diagnostic logs from other workspaces.
  • There is already a retention period applied to the diagnostics logs in the workspace

Microsoft Entra supported identities

This API supports the Microsoft identities listed in this section.

Identity Support
User Yes
Service principal and Managed identities Yes

Interface

POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/onelake/settings/modifyImmutabilityPolicy

URI Parameters

Name In Required Type Description
workspaceId
path True

string (uuid)

The workspace ID.

Request Body

Name Required Type Description
retentionDays True

integer

minimum: 1

Retention Days for the action.

scope True

ImmutabilityScope

Scope of the current immutability setting.

Responses

Name Type Description
200 OK

Request completed successfully.

429 Too Many Requests

ErrorResponse

The service rate limit was exceeded. The server returns a Retry-After header indicating, in seconds, how long the client must wait before sending additional requests.

Headers

Retry-After: integer

Other Status Codes

ErrorResponse

Common error codes:

  • UserNotAuthorized - User must be an admin of the workspace to enable diagnostics settings.

  • WorkspaceNotFound - Workspace not found.

  • RetentionDaysReductionNotAllowed - Retention days cannot be reduced than what is already set.

  • WorkspaceNotSupported - Workspace is not supported for setting diagnostic immutability policy.

  • InternalServerError - Other Internal Errors.

Examples

Enable immutability for diagnostic logs example
Reduce retention days example (error case)

Enable immutability for diagnostic logs example

Sample request

POST https://api.fabric.microsoft.com/v1/workspaces/cfafbeb1-8037-4d0c-896e-a46fb27ff227/onelake/settings/modifyImmutabilityPolicy

{
  "scope": "DiagnosticLogs",
  "retentionDays": 7
}

Sample response

Reduce retention days example (error case)

Sample request

POST https://api.fabric.microsoft.com/v1/workspaces/cfafbeb1-8037-4d0c-896e-a46fb27ff227/onelake/settings/modifyImmutabilityPolicy

{
  "scope": "DiagnosticLogs",
  "retentionDays": 3
}

Sample response

{
  "requestId": "e7d4be9d-423c-4b26-b4e4-35de77c89e26",
  "errorCode": "BadRequest",
  "moreDetails": [
    {
      "errorCode": "RetentionDaysReductionNotAllowed ",
      "message": "",
      "relatedResource": {
        "resourceId": "4a0afce7-520f-4542-b7ff-6f6252c7008b",
        "resourceType": "Workspace"
      }
    }
  ],
  "message": "The request could not be processed due to missing or invalid information",
  "relatedResource": {
    "resourceId": "4a0afce7-520f-4542-b7ff-6f6252c7008b",
    "resourceType": "Workspace"
  }
}

Definitions

Name Description
ErrorRelatedResource

The error related resource details object.

ErrorResponse

The error response.

ErrorResponseDetails

The error response details.

ImmutabilityPolicyRequest

Immutability policy request object.

ImmutabilityScope

The scope of immutability policy. Additional Immutability Scope types may be added over time.

ErrorRelatedResource

The error related resource details object.

Name Type Description
resourceId

string

The resource ID that's involved in the error.

resourceType

string

The type of the resource that's involved in the error.

ErrorResponse

The error response.

Name Type Description
errorCode

string

A specific identifier that provides information about an error condition, allowing for standardized communication between our service and its users.

message

string

A human readable representation of the error.

moreDetails

ErrorResponseDetails[]

List of additional error details.

relatedResource

ErrorRelatedResource

The error related resource details.

requestId

string (uuid)

ID of the request associated with the error.

ErrorResponseDetails

The error response details.

Name Type Description
errorCode

string

A specific identifier that provides information about an error condition, allowing for standardized communication between our service and its users.

message

string

A human readable representation of the error.

relatedResource

ErrorRelatedResource

The error related resource details.

ImmutabilityPolicyRequest

Immutability policy request object.

Name Type Description
retentionDays

integer

minimum: 1

Retention Days for the action.

scope

ImmutabilityScope

Scope of the current immutability setting.

ImmutabilityScope

The scope of immutability policy. Additional Immutability Scope types may be added over time.

Value Description
DiagnosticLogs

Immutability policy for diagnostic logs.