You have to use az storage directory delete
instead of az storage file delete
to delete a folder present inside the Fileshare as file delete only deletes files and not the folders (directories).
I tested the Scenario in my environment :

But When I directly use the below command , I get another error as the directory is not empty , its not able to delete the entire directory.
az storage directory delete --share-name test --name ansumandirectory --account-name ansumanadls1234 --account-key <accountkey>

So , In order to delete the Directory ,I have to delete the files present inside it as well first . So I used the below script :
$sharename = "test"
$foldername = "ansumandirectory"
$accountname = "ansumanadls1234"
$accountkey = "accountkey"
$source= "$sharename/$foldername"
az storage file delete-batch --source $source --account-name $accountname --account-key $accountkey
az storage directory delete --share-name $sharename --name $foldername --account-name $accountname --account-key $accountkey
Output:


Note: If Your directory is Empty then you can directly use the az storage directory delete
command , it will delete the folder. But if its not empty then use the az storage file delete-batch
to delete all the files with the directory delete command (as done in the above script).