@@ -133,9 +133,21 @@ interface SnowflakeDriverExportGCS {
133133interface SnowflakeDriverExportAzure {
134134 bucketType : 'azure' ,
135135 bucketName : string ,
136- azureKey : string ,
136+ azureKey ? : string ,
137137 sasToken ?: string ,
138138 integrationName ?: string ,
139+ /**
140+ * The client ID of a Microsoft Entra app registration.
141+ */
142+ clientId ?: string ,
143+ /**
144+ * ID of the application's Microsoft Entra tenant. Also called its directory ID.
145+ */
146+ tenantId ?: string ,
147+ /**
148+ * The path to a file containing a Kubernetes service account token that authenticates the identity.
149+ */
150+ tokenFilePath ?: string ,
139151}
140152
141153export type SnowflakeDriverExportBucket = SnowflakeDriverExportAWS | SnowflakeDriverExportGCS
@@ -317,12 +329,36 @@ export class SnowflakeDriver extends BaseDriver implements DriverInterface {
317329 // sasToken is optional for azure if storage integration is used
318330 const sasToken = getEnv ( 'dbExportAzureSasToken' , { dataSource } ) ;
319331
332+ if ( ! integrationName && ! sasToken ) {
333+ throw new Error (
334+ 'Unsupported exportBucket configuration, some keys are empty: integrationName|sasToken'
335+ ) ;
336+ }
337+
338+ // azureKey is optional if DefaultAzureCredential() is used
339+ const azureKey = getEnv ( 'dbExportBucketAzureKey' , { dataSource } ) ;
340+
341+ // These 3 options make sense in case you want to authorize to Azure from
342+ // application running in the k8s environment.
343+ const clientId = getEnv ( 'dbExportBucketAzureClientId' , { dataSource } ) ;
344+ const tenantId = getEnv ( 'dbExportBucketAzureTenantId' , { dataSource } ) ;
345+ const tokenFilePath = getEnv ( 'dbExportBucketAzureTokenFilePAth' , { dataSource } ) ;
346+
347+ if ( ! azureKey && ! clientId && ! tenantId && ! tokenFilePath ) {
348+ throw new Error (
349+ 'Unsupported exportBucket configuration, some keys are empty: azureKey or (clientId, tenantId, tokenFilePath)'
350+ ) ;
351+ }
352+
320353 return {
321354 bucketType,
322355 bucketName : getEnv ( 'dbExportBucket' , { dataSource } ) ,
323- azureKey : getEnv ( 'dbExportBucketAzureKey' , { dataSource } ) ,
324- ...( sasToken !== undefined && { sasToken } ) ,
325356 ...( integrationName !== undefined && { integrationName } ) ,
357+ ...( sasToken !== undefined && { sasToken } ) ,
358+ ...( azureKey !== undefined && { azureKey } ) ,
359+ ...( clientId !== undefined && { clientId } ) ,
360+ ...( tenantId !== undefined && { tenantId } ) ,
361+ ...( tokenFilePath !== undefined && { tokenFilePath } ) ,
326362 } ;
327363 }
328364
@@ -643,11 +679,11 @@ export class SnowflakeDriver extends BaseDriver implements DriverInterface {
643679 ) ;
644680 return this . extractFilesFromGCS ( { credentials } , bucketName , tableName ) ;
645681 } else if ( bucketType === 'azure' ) {
646- const { azureKey, sasToken } = (
682+ const { azureKey, sasToken, clientId , tenantId , tokenFilePath } = (
647683 < SnowflakeDriverExportAzure > this . config . exportBucket
648684 ) ;
649685 return this . extractFilesFromAzure (
650- { azureKey, sasToken } ,
686+ { azureKey, sasToken, clientId , tenantId , tokenFilePath } ,
651687 bucketName ,
652688 tableName ,
653689 ) ;
0 commit comments