Edit

OneLake Lifecycle Policy - Import Policy

Imports a OneLake lifecycle management policy for a workspace.
Creates or replaces the OneLake lifecycle management policy for a workspace. The policy must be sent in full as a complete replacement. To delete an existing policy, send a request with an empty rules array.

In OneLake, lifecycle rules are scoped to the workspace. The prefixMatch filter starts at the item level, so prefixMatch values must begin with a valid item name or item ID (for example, "MyLakehouse.Lakehouse/Files/data"). Setting the prefixMatch to "*/diagnosticLogs" applies the rule to all diagnostic events routed to that workspace.

OneLake supports the same lifecycle policy structure as Azure Storage lifecycle management, with the following exceptions:

  • OneLake does not support the TierToArchive action.
  • OneLake does not support the Delete action.
  • OneLake does not support the blobIndexMatch filter.

For more information, see OneLake lifecycle management.

Permissions

The caller must have an admin workspace role.

Required Delegated Scopes

OneLake.ReadWrite.All

Limitations

  • The tierToArchive action is not supported.
  • The delete action is not supported.
  • The blobIndexMatch filter is not supported.

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/lifecycle/importPolicy

URI Parameters

Name In Required Type Description
workspaceId
path True

string (uuid)

The workspace ID.

Request Body

Name Required Type Description
properties True

object

The lifecycle policy properties. The structure follows Azure Storage lifecycle management.

Responses

Name Type Description
200 OK

OneLakeWorkspaceLifecyclePolicyResponse

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:

  • UnknownError - An error occurred.

  • EntityNotFound - Workspace not found.

  • InvalidInput - Invalid request body.

  • UserNotAuthorizedForWorkspaceLifecycle - User is not authorized for the workspace.

  • LifecycleNotAllowedForMyWorkspace - Lifecycle settings are not allowed on My Workspace.

Examples

Import empty OneLake lifecycle policy (delete) example
Import OneLake lifecycle policy create example
Import OneLake lifecycle policy with diagnostic events scope example
Import OneLake lifecycle policy with multiple actions example
Import OneLake lifecycle policy with multiple rules example

Import empty OneLake lifecycle policy (delete) example

Sample request

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

{
  "properties": {
    "policy": {
      "rules": []
    }
  }
}

Sample response

{
  "properties": {
    "policy": {
      "rules": []
    }
  }
}

Import OneLake lifecycle policy create example

Sample request

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

{
  "properties": {
    "policy": {
      "rules": [
        {
          "name": "BasicCoolTier",
          "enabled": true,
          "type": "Lifecycle",
          "definition": {
            "actions": {
              "baseBlob": {
                "tierToCool": {
                  "daysAfterLastAccessTimeGreaterThan": 30
                }
              }
            },
            "filters": {
              "blobTypes": [
                "blockBlob"
              ]
            }
          }
        }
      ]
    }
  }
}

Sample response

{
  "properties": {
    "lastModifiedTime": "2026-02-27T00:10:45.123456Z",
    "policy": {
      "rules": [
        {
          "name": "BasicCoolTier",
          "enabled": true,
          "type": "Lifecycle",
          "definition": {
            "actions": {
              "baseBlob": {
                "tierToCool": {
                  "daysAfterLastAccessTimeGreaterThan": 30
                }
              }
            },
            "filters": {
              "blobTypes": [
                "blockBlob"
              ]
            }
          }
        }
      ]
    }
  },
  "type": "Microsoft.Storage/storageAccounts/managementPolicies"
}

Import OneLake lifecycle policy with diagnostic events scope example

Sample request

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

{
  "properties": {
    "policy": {
      "rules": [
        {
          "name": "WithPrefixMatch",
          "enabled": true,
          "type": "Lifecycle",
          "definition": {
            "filters": {
              "prefixMatch": [
                "*/diagnosticLogs"
              ],
              "blobTypes": [
                "blockBlob"
              ]
            },
            "actions": {
              "baseBlob": {
                "tierToCool": {
                  "daysAfterLastAccessTimeGreaterThan": 30
                }
              }
            }
          }
        }
      ]
    }
  }
}

Sample response

{
  "properties": {
    "lastModifiedTime": "2026-02-27T00:25:08.654321Z",
    "policy": {
      "rules": [
        {
          "name": "WithPrefixMatch",
          "enabled": true,
          "type": "Lifecycle",
          "definition": {
            "actions": {
              "baseBlob": {
                "tierToCool": {
                  "daysAfterLastAccessTimeGreaterThan": 30
                }
              }
            },
            "filters": {
              "prefixMatch": [
                "*/diagnosticLogs"
              ],
              "blobTypes": [
                "blockBlob"
              ]
            }
          }
        }
      ]
    }
  },
  "type": "Microsoft.Storage/storageAccounts/managementPolicies"
}

Import OneLake lifecycle policy with multiple actions example

Sample request

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

{
  "properties": {
    "policy": {
      "rules": [
        {
          "name": "MultiTierRule",
          "enabled": true,
          "type": "Lifecycle",
          "definition": {
            "actions": {
              "baseBlob": {
                "tierToCool": {
                  "daysAfterLastAccessTimeGreaterThan": 30
                },
                "tierToCold": {
                  "daysAfterModificationGreaterThan": 90
                },
                "enableAutoTierToHotFromCool": true
              }
            },
            "filters": {
              "blobTypes": [
                "blockBlob"
              ]
            }
          }
        }
      ]
    }
  }
}

Sample response

{
  "properties": {
    "lastModifiedTime": "2026-02-27T00:15:30.987654Z",
    "policy": {
      "rules": [
        {
          "name": "MultiTierRule",
          "enabled": true,
          "type": "Lifecycle",
          "definition": {
            "actions": {
              "baseBlob": {
                "tierToCool": {
                  "daysAfterLastAccessTimeGreaterThan": 30
                },
                "tierToCold": {
                  "daysAfterModificationGreaterThan": 90
                },
                "enableAutoTierToHotFromCool": true
              }
            },
            "filters": {
              "blobTypes": [
                "blockBlob"
              ]
            }
          }
        }
      ]
    }
  },
  "type": "Microsoft.Storage/storageAccounts/managementPolicies"
}

Import OneLake lifecycle policy with multiple rules example

Sample request

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

{
  "properties": {
    "policy": {
      "rules": [
        {
          "name": "Rule1_CoolAfterAccess",
          "enabled": true,
          "type": "Lifecycle",
          "definition": {
            "filters": {
              "blobTypes": [
                "blockBlob"
              ]
            },
            "actions": {
              "baseBlob": {
                "tierToCool": {
                  "daysAfterLastAccessTimeGreaterThan": 14
                }
              }
            }
          }
        },
        {
          "name": "Rule2_ColdAfterCreation",
          "enabled": true,
          "type": "Lifecycle",
          "definition": {
            "filters": {
              "blobTypes": [
                "blockBlob"
              ]
            },
            "actions": {
              "baseBlob": {
                "tierToCold": {
                  "daysAfterCreationGreaterThan": 180
                }
              }
            }
          }
        }
      ]
    }
  }
}

Sample response

{
  "properties": {
    "lastModifiedTime": "2026-02-27T00:20:12.345678Z",
    "policy": {
      "rules": [
        {
          "name": "Rule1_CoolAfterAccess",
          "enabled": true,
          "type": "Lifecycle",
          "definition": {
            "actions": {
              "baseBlob": {
                "tierToCool": {
                  "daysAfterLastAccessTimeGreaterThan": 14
                }
              }
            },
            "filters": {
              "blobTypes": [
                "blockBlob"
              ]
            }
          }
        },
        {
          "name": "Rule2_ColdAfterCreation",
          "enabled": true,
          "type": "Lifecycle",
          "definition": {
            "actions": {
              "baseBlob": {
                "tierToCold": {
                  "daysAfterCreationGreaterThan": 180
                }
              }
            },
            "filters": {
              "blobTypes": [
                "blockBlob"
              ]
            }
          }
        }
      ]
    }
  },
  "type": "Microsoft.Storage/storageAccounts/managementPolicies"
}

Definitions

Name Description
ErrorRelatedResource

The error related resource details object.

ErrorResponse

The error response.

ErrorResponseDetails

The error response details.

ImportOneLakeWorkspaceLifecyclePolicyRequest

Request for importing a OneLake workspace lifecycle policy. The request body follows the same structure as Azure Storage lifecycle management. Send an empty rules array to delete the existing policy.

OneLakeWorkspaceLifecyclePolicyResponse

The OneLake workspace lifecycle policy response. Contains the policy properties and type as returned by Azure Storage lifecycle management.

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.

isRetriable

boolean

When true, the request can be retried. Use the Retry-After response header to determine the delay, if available.

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.

ImportOneLakeWorkspaceLifecyclePolicyRequest

Request for importing a OneLake workspace lifecycle policy. The request body follows the same structure as Azure Storage lifecycle management. Send an empty rules array to delete the existing policy.

Name Type Description
properties

object

The lifecycle policy properties. The structure follows Azure Storage lifecycle management.

OneLakeWorkspaceLifecyclePolicyResponse

The OneLake workspace lifecycle policy response. Contains the policy properties and type as returned by Azure Storage lifecycle management.

Name Type Description
properties

object

The lifecycle policy properties. The structure follows Azure Storage lifecycle management.

type

string

The ARM resource type, as returned by Azure Storage lifecycle management.