@@ -2,11 +2,12 @@ import {
22 BlobServiceClient ,
33 type ContainerClient ,
44 StorageSharedKeyCredential ,
5- type BlockBlobUploadOptions
5+ type BlockBlobUploadOptions ,
6+ AnonymousCredential
67} from '@azure/storage-blob' ;
78import Cache from 'nice-cache' ;
89import fs from 'fs-extra' ;
9- import { DefaultAzureCredential } from '@azure/identity' ;
10+ import { DefaultAzureCredential , TokenCredential } from '@azure/identity' ;
1011import nodeDir , { type PathsResult } from 'node-dir' ;
1112import { promisify } from 'util' ;
1213import {
@@ -58,6 +59,11 @@ export interface AzureConfig extends StorageAdapterBaseConfig {
5859 * to Azure's default credential chain (`DefaultAzureCredential`). Optional.
5960 */
6061 accountKey ?: string ;
62+
63+ credential ?:
64+ | StorageSharedKeyCredential
65+ | AnonymousCredential
66+ | TokenCredential ;
6167}
6268
6369export default function azureAdapter ( conf : AzureConfig ) : StorageAdapter {
@@ -86,7 +92,9 @@ export default function azureAdapter(conf: AzureConfig): StorageAdapter {
8692 `https://${ conf . accountName } .blob.core.windows.net` ,
8793 conf . accountName && conf . accountKey
8894 ? new StorageSharedKeyCredential ( conf . accountName , conf . accountKey )
89- : new DefaultAzureCredential ( )
95+ : conf . credential
96+ ? conf . credential
97+ : new DefaultAzureCredential ( )
9098 ) ;
9199 publicClient = client . getContainerClient ( conf . publicContainerName ) ;
92100 privateClient = client . getContainerClient ( conf . privateContainerName ) ;
0 commit comments