Search code examples
azureazure-blob-storageazure-cli

Azure CLI - az storage blob directory exists does not work


I have a not empty directory in Azure Blob storage. My directory Blob in Azure console

But Azure CLI says that it not exists.

az storage blob directory exists -c jenkinsworkspaces -d "uild-pr-new_ecom-lora-ng_PR-5593" --connection-string="XXX" -o json

This command is implicitly deprecated because command group 'storage blob directory' 
is deprecated and will be removed in a future release. Use 'az storage fs directory' 
instead.
{
  "exists": false
}

Don't understand why?

I precise that is the same with az storage fs directory exists


Solution

  • I believe you are getting false back is because your storage account is a regular storage account and does not have hierarchical namespace enabled i.e. your storage account is not a Data Lake Gen2 account.

    In regular storage accounts, the folders are virtual. They are real folders in Data Lake Gen2 accounts. All the directory related commands will only work with Data Lake Gen2 accounts. Documentation unfortunately does not mention it.