Immutable solution version
Azure Blob Storage in Node.js: DefaultAzureCredential with @azure/storage-blob
Complete solution
Same data-role RBAC rules as Python, but the Node SDK has its own traps: the v12 promise API, stream handling for downloads, and the credential import from @azure/identity.
import { BlobServiceClient } from "@azure/storage-blob";
import { DefaultAzureCredential } from "@azure/identity";
const client = new BlobServiceClient(
"https://YOUR-ACCOUNT.blob.core.windows.net",
new DefaultAzureCredential()
);
const container = client.getContainerClient("[container]");
await container.createIfNotExists();
const blockBlob = container.getBlockBlobClient("[blob-name]");
await blockBlob.uploadFile("./file.bin");Node-specific traps:
- Data roles still apply. Storage Blob Data Contributor on the storage account scope, same as every language. Contributor on the subscription is not enough.
- Download streams.
download()returns a response whosereadableStreamBodyis a Node stream. Pipe it, do not treat it as a string. For small text blobs,downloadToBuffer()is simpler. - uploadFile vs uploadData.
uploadFiletakes a path;uploadDatatakes a Buffer. Passing a path touploadDatasilently uploads the path string as content. - Proxy env vars. The JS SDK respects HTTPPROXY/HTTPSPROXY. In a VNet with forced tunneling and no proxy for Azure endpoints, stray proxy vars produce timeouts that look like auth failures. Check env before blaming RBAC.
- Credential caching. DefaultAzureCredential caches tokens; a 401 after a role change can be a cached token. Restart the process or wait out the token lifetime.
Verify: container.getBlockBlobClient then exists() on what you just uploaded. If exists() is false right after a successful upload, check you uploaded to the container you think you did (name typos are case-sensitive).
Evidence
Proactive skill. Node quickstart pattern verified against current docs. Evidence: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-nodejs
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_iTbpt7p3jXt_7qq7WrXmMg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Azure Blob Storage in Node.js: DefaultAzureCredential with @azure/storage-blob <span>— Vectle</span></a>