17
17
18
18
use crate :: azure:: client:: { AzureClient , AzureConfig } ;
19
19
use crate :: azure:: credential:: {
20
- AzureAccessKey , AzureCliCredential , ClientSecretOAuthProvider , ImdsManagedIdentityProvider ,
21
- WorkloadIdentityOAuthProvider ,
20
+ AzureAccessKey , AzureCliCredential , ClientSecretOAuthProvider , FabricTokenOAuthProvider ,
21
+ ImdsManagedIdentityProvider , WorkloadIdentityOAuthProvider ,
22
22
} ;
23
23
use crate :: azure:: { AzureCredential , AzureCredentialProvider , MicrosoftAzure , STORE } ;
24
24
use crate :: client:: TokenCredentialProvider ;
@@ -172,6 +172,14 @@ pub struct MicrosoftAzureBuilder {
172
172
use_fabric_endpoint : ConfigValue < bool > ,
173
173
/// When set to true, skips tagging objects
174
174
disable_tagging : ConfigValue < bool > ,
175
+ /// Fabric token service url
176
+ fabric_token_service_url : Option < String > ,
177
+ /// Fabric workload host
178
+ fabric_workload_host : Option < String > ,
179
+ /// Fabric session token
180
+ fabric_session_token : Option < String > ,
181
+ /// Fabric cluster identifier
182
+ fabric_cluster_identifier : Option < String > ,
175
183
}
176
184
177
185
/// Configuration keys for [`MicrosoftAzureBuilder`]
@@ -336,6 +344,34 @@ pub enum AzureConfigKey {
336
344
/// - `disable_tagging`
337
345
DisableTagging ,
338
346
347
+ /// Fabric token service url
348
+ ///
349
+ /// Supported keys:
350
+ /// - `azure_fabric_token_service_url`
351
+ /// - `fabric_token_service_url`
352
+ FabricTokenServiceUrl ,
353
+
354
+ /// Fabric workload host
355
+ ///
356
+ /// Supported keys:
357
+ /// - `azure_fabric_workload_host`
358
+ /// - `fabric_workload_host`
359
+ FabricWorkloadHost ,
360
+
361
+ /// Fabric session token
362
+ ///
363
+ /// Supported keys:
364
+ /// - `azure_fabric_session_token`
365
+ /// - `fabric_session_token`
366
+ FabricSessionToken ,
367
+
368
+ /// Fabric cluster identifier
369
+ ///
370
+ /// Supported keys:
371
+ /// - `azure_fabric_cluster_identifier`
372
+ /// - `fabric_cluster_identifier`
373
+ FabricClusterIdentifier ,
374
+
339
375
/// Client options
340
376
Client ( ClientConfigKey ) ,
341
377
}
@@ -361,6 +397,10 @@ impl AsRef<str> for AzureConfigKey {
361
397
Self :: SkipSignature => "azure_skip_signature" ,
362
398
Self :: ContainerName => "azure_container_name" ,
363
399
Self :: DisableTagging => "azure_disable_tagging" ,
400
+ Self :: FabricTokenServiceUrl => "azure_fabric_token_service_url" ,
401
+ Self :: FabricWorkloadHost => "azure_fabric_workload_host" ,
402
+ Self :: FabricSessionToken => "azure_fabric_session_token" ,
403
+ Self :: FabricClusterIdentifier => "azure_fabric_cluster_identifier" ,
364
404
Self :: Client ( key) => key. as_ref ( ) ,
365
405
}
366
406
}
@@ -406,6 +446,14 @@ impl FromStr for AzureConfigKey {
406
446
"azure_skip_signature" | "skip_signature" => Ok ( Self :: SkipSignature ) ,
407
447
"azure_container_name" | "container_name" => Ok ( Self :: ContainerName ) ,
408
448
"azure_disable_tagging" | "disable_tagging" => Ok ( Self :: DisableTagging ) ,
449
+ "azure_fabric_token_service_url" | "fabric_token_service_url" => {
450
+ Ok ( Self :: FabricTokenServiceUrl )
451
+ }
452
+ "azure_fabric_workload_host" | "fabric_workload_host" => Ok ( Self :: FabricWorkloadHost ) ,
453
+ "azure_fabric_session_token" | "fabric_session_token" => Ok ( Self :: FabricSessionToken ) ,
454
+ "azure_fabric_cluster_identifier" | "fabric_cluster_identifier" => {
455
+ Ok ( Self :: FabricClusterIdentifier )
456
+ }
409
457
// Backwards compatibility
410
458
"azure_allow_http" => Ok ( Self :: Client ( ClientConfigKey :: AllowHttp ) ) ,
411
459
_ => match s. strip_prefix ( "azure_" ) . unwrap_or ( s) . parse ( ) {
@@ -525,6 +573,14 @@ impl MicrosoftAzureBuilder {
525
573
}
526
574
AzureConfigKey :: ContainerName => self . container_name = Some ( value. into ( ) ) ,
527
575
AzureConfigKey :: DisableTagging => self . disable_tagging . parse ( value) ,
576
+ AzureConfigKey :: FabricTokenServiceUrl => {
577
+ self . fabric_token_service_url = Some ( value. into ( ) )
578
+ }
579
+ AzureConfigKey :: FabricWorkloadHost => self . fabric_workload_host = Some ( value. into ( ) ) ,
580
+ AzureConfigKey :: FabricSessionToken => self . fabric_session_token = Some ( value. into ( ) ) ,
581
+ AzureConfigKey :: FabricClusterIdentifier => {
582
+ self . fabric_cluster_identifier = Some ( value. into ( ) )
583
+ }
528
584
} ;
529
585
self
530
586
}
@@ -561,6 +617,10 @@ impl MicrosoftAzureBuilder {
561
617
AzureConfigKey :: Client ( key) => self . client_options . get_config_value ( key) ,
562
618
AzureConfigKey :: ContainerName => self . container_name . clone ( ) ,
563
619
AzureConfigKey :: DisableTagging => Some ( self . disable_tagging . to_string ( ) ) ,
620
+ AzureConfigKey :: FabricTokenServiceUrl => self . fabric_token_service_url . clone ( ) ,
621
+ AzureConfigKey :: FabricWorkloadHost => self . fabric_workload_host . clone ( ) ,
622
+ AzureConfigKey :: FabricSessionToken => self . fabric_session_token . clone ( ) ,
623
+ AzureConfigKey :: FabricClusterIdentifier => self . fabric_cluster_identifier . clone ( ) ,
564
624
}
565
625
}
566
626
@@ -856,6 +916,30 @@ impl MicrosoftAzureBuilder {
856
916
857
917
let credential = if let Some ( credential) = self . credentials {
858
918
credential
919
+ } else if let (
920
+ Some ( fabric_token_service_url) ,
921
+ Some ( fabric_workload_host) ,
922
+ Some ( fabric_session_token) ,
923
+ Some ( fabric_cluster_identifier) ,
924
+ ) = (
925
+ & self . fabric_token_service_url ,
926
+ & self . fabric_workload_host ,
927
+ & self . fabric_session_token ,
928
+ & self . fabric_cluster_identifier ,
929
+ ) {
930
+ // This case should precede the bearer token case because it is more specific and will utilize the bearer token.
931
+ let fabric_credential = FabricTokenOAuthProvider :: new (
932
+ fabric_token_service_url,
933
+ fabric_workload_host,
934
+ fabric_session_token,
935
+ fabric_cluster_identifier,
936
+ self . bearer_token . clone ( ) ,
937
+ ) ;
938
+ Arc :: new ( TokenCredentialProvider :: new (
939
+ fabric_credential,
940
+ self . client_options . client ( ) ?,
941
+ self . retry_config . clone ( ) ,
942
+ ) ) as _
859
943
} else if let Some ( bearer_token) = self . bearer_token {
860
944
static_creds ( AzureCredential :: BearerToken ( bearer_token) )
861
945
} else if let Some ( access_key) = self . access_key {
0 commit comments