77using Microsoft . Extensions . Configuration ;
88using Microsoft . Extensions . DependencyInjection ;
99using Microsoft . Extensions . Options ;
10+ using NuGet . Services . Configuration ;
1011using NuGetGallery ;
1112
1213namespace NuGet . Jobs
1314{
1415 public static class StorageAccountHelper
1516 {
16- private const string StorageUseManagedIdentityPropertyName = "Storage_UseManagedIdentity" ;
17- private const string StorageManagedIdentityClientIdPropertyName = "Storage_ManagedIdentityClientId" ;
18-
1917 public static IServiceCollection ConfigureStorageMsi (
2018 this IServiceCollection serviceCollection ,
2119 IConfiguration configuration ,
22- string useManageIdentityPropertyName = null ,
23- string managedIdentityClientIdPropertyName = null )
20+ string storageUseManagedIdentityPropertyName = null ,
21+ string storageManagedIdentityClientIdPropertyName = null )
2422 {
2523 if ( serviceCollection == null )
2624 {
@@ -31,12 +29,16 @@ public static IServiceCollection ConfigureStorageMsi(
3129 throw new ArgumentNullException ( nameof ( configuration ) ) ;
3230 }
3331
34- useManageIdentityPropertyName ??= StorageUseManagedIdentityPropertyName ;
35- managedIdentityClientIdPropertyName ??= StorageManagedIdentityClientIdPropertyName ;
32+ storageUseManagedIdentityPropertyName ??= Constants . StorageUseManagedIdentityPropertyName ;
33+ storageManagedIdentityClientIdPropertyName ??= Constants . StorageManagedIdentityClientIdPropertyName ;
3634
37- string useManagedIdentityStr = configuration [ useManageIdentityPropertyName ] ;
38- string managedIdentityClientId = configuration [ managedIdentityClientIdPropertyName ] ;
35+ string useManagedIdentityStr = configuration [ storageUseManagedIdentityPropertyName ] ;
3936 bool useManagedIdentity = false ;
37+
38+ string managedIdentityClientId = string . IsNullOrWhiteSpace ( configuration [ storageManagedIdentityClientIdPropertyName ] )
39+ ? configuration [ Constants . ManagedIdentityClientIdKey ]
40+ : configuration [ storageManagedIdentityClientIdPropertyName ] ;
41+
4042 if ( ! string . IsNullOrWhiteSpace ( useManagedIdentityStr ) )
4143 {
4244 useManagedIdentity = bool . Parse ( useManagedIdentityStr ) ;
0 commit comments