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,11 +29,13 @@ 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 ] ;
36+ string managedIdentityClientId = string . IsNullOrEmpty ( configuration [ storageManagedIdentityClientIdPropertyName ] )
37+ ? configuration [ Constants . ManagedIdentityClientIdKey ]
38+ : configuration [ storageManagedIdentityClientIdPropertyName ] ;
3939 bool useManagedIdentity = false ;
4040 if ( ! string . IsNullOrWhiteSpace ( useManagedIdentityStr ) )
4141 {
0 commit comments