Azure Blob Delete
Select text in any SQL script, run Blob Delete: Delete Folder(s) From Selection, and any
'BlobDelete'::'partial/path/to/folder' marker in the selection is deleted from Azure Data Lake Storage Gen2 via the
Azure CLI.
The marker is recognised anywhere in the selection — line comments, block comments, or inline next to SQL:
-- 'BlobDelete'::'partial/path/to/folder'
/*
'BlobDelete'::'partial/path/to/folder'
*/
DROP EXTERNAL TABLE schemaName.tableName -- 'BlobDelete'::'partial/path/to/folder'
Each match runs:
az storage fs directory delete --account-name <accountName> --file-system <fileSystem> \
--name "<pathPrefix>/<partial/path/to/folder>" --auth-mode login --yes
Settings (set these per workspace)
| Setting |
Required |
Description |
blobDelete.accountName |
yes |
Storage account name |
blobDelete.fileSystem |
yes |
File system / container |
blobDelete.pathPrefix |
yes |
Prefix prepended to the partial path |
blobDelete.confirmBeforeDelete |
no |
Modal confirmation, default true |
blobDelete.authMode |
no |
login (default) or key |
blobDelete.azCommand |
no |
Azure CLI path, default az |
blobDelete.triggerWord |
no |
Default BlobDelete |
Example .vscode/settings.json:
{
"blobDelete.accountName": "accountName",
"blobDelete.fileSystem": "fileSystem",
"blobDelete.pathPrefix": "rest/of/path"
}
If any required setting is empty, nothing is deleted and you are prompted to open settings.
Binding F5
No keybinding ships by default. To bind it for SQL files only, add to
keybindings.json:
{
"key": "f7",
"command": "blobDelete.deleteFromSelection",
"when": "editorTextFocus && editorHasSelection && editorLangId == sql"
}
Requirements
This extension is a thin wrapper around the Azure CLI. Nothing works until all three of these are true:
- Azure CLI is installed and on
PATH.
Install from https://learn.microsoft.com/cli/azure/install-azure-cli (Windows: winget install -e --id Microsoft.AzureCLI).
After installing, reload VS Code — an already-running VS Code keeps the old PATH and will still
report the CLI as missing. Verify with az version in a new terminal.
If az lives somewhere that is not on PATH, point blobDelete.azCommand at the full executable path,
e.g. C:\\Program Files\\Microsoft SDKs\\Azure\\CLI2\\wbin\\az.cmd.
- You are signed in. Run
az login (or az login --tenant <tenantId> if your storage account is in
another tenant). If you have several subscriptions, select the right one with
az account set --subscription "<name or id>".
- Your account has data-plane access.
--auth-mode login uses your Entra ID identity, so you need
the Storage Blob Data Contributor role on the container (Owner/Contributor at the management plane
is not enough to delete blobs).
Check your setup
Run Blob Delete: Check Setup (Azure CLI & Settings) from the Command Palette. It reports the
resolved settings, whether the CLI is reachable, and the signed-in user / subscription / tenant, and
offers a one-click fix for whatever is wrong.
Before every delete the extension runs az account show as a preflight. If it fails you get a
notification with the appropriate action instead of a raw CLI error:
| Situation |
Notification |
Action buttons |
CLI missing / not on PATH |
"the Azure CLI is not installed or not on PATH" |
Install Azure CLI, Set CLI Path, Show Details |
| Not signed in / token expired |
"you are not signed in to Azure" |
Run az login (opens a terminal and runs it), Show Details |
| CLI present but failing for another reason |
"the Azure CLI could not be verified" + the CLI's own message |
Show Details |
Troubleshooting
| Symptom |
Likely cause |
Fix |
'az' was not found on PATH even though it is installed |
VS Code was started before the install |
Reload window, or set blobDelete.azCommand to the full path |
| Sign-in prompt keeps returning |
Session expired, or you logged into a different tenant |
az login --tenant <tenantId> |
Storage Blob Data Contributor error |
Management-plane role only |
Ask for the data-plane role on the container |
| "file system does not exist" |
Wrong blobDelete.fileSystem, or right container in the wrong subscription |
Fix the setting, or az account set --subscription ... |
| "folder does not exist" |
blobDelete.pathPrefix plus the marker path do not resolve |
Check the exact path printed in the output channel |
| Deletes hit the wrong account |
Settings are user-scoped instead of workspace-scoped |
Put them in .vscode/settings.json |
Every run logs the exact command line and full CLI output to the Azure Blob Delete output
channel; Show Details on any notification opens it.
Development
npm install
npm run compile
Then press Run Extension in the Run and Debug view.