deleteIfExists blob API not working as expected with OneLake endpoint

azureuser 0 Reputation points
2025-12-10T21:23:58.7966667+00:00

I have Java code that uses azure-storage-blob version 12.31.3. When calling CloudBlob.deleteIfExists on a regular Azure Blob with the endpoint **`

Azure Data Lake Storage
Azure Data Lake Storage
An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Smaran Thoomu 32,530 Reputation points Microsoft External Staff Moderator
    2025-12-11T05:25:49.2266667+00:00

    Hi azureuser
    Thanks for reaching out!

    The issue you’re seeing is expected because OneLake endpoints do not fully support all Azure Blob Storage SDK operations, especially older methods like CloudBlob.deleteIfExists. OneLake is built on top of Microsoft Fabric / ADLS Gen2, and it has different API behavior compared to a standard Azure Blob endpoint.

    Why this happens

    deleteIfExists works normally on Azure Blob Storage, but OneLake is not a traditional Blob service, so the Blob SDK may not behave consistently or may fail silently.

    What you should use instead

    To work with OneLake, Microsoft recommends using:

    DFS (Data Lake Gen2) REST API, or

    Azure Storage Blob SDK (latest versions) with DFS endpoints, not classic Blob endpoints.

    If you want to delete a file reliably, use:

    DataLakeFileClient fileClient = dataLakeServiceClient
        .getFileSystemClient("filesystem")
        .getDirectoryClient("path")
        .getFileClient("file");
    
    fileClient.deleteIfExists();
    

    Recommendation:

    Please check the endpoint you are using. If it looks like:

    https://<workspace>.onelake.fabric.microsoft.com/...
    

    then Blob APIs may not work as expected.

    Switching to DataLake SDK or DFS endpoint should resolve the issue.

    Hope this help. Please let me know if you have any questions.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.