@@ -18,7 +18,7 @@ public static class EnvironmentConfigurationExtension
1818 /// <param name="configuration">Configuration Manager.</param>
1919 /// <param name="applicationName">Application name.</param>
2020 /// <param name="applicationDescription">Application description.</param>
21- /// <param name="managedIdentityResourceId ">Resource Identifier if using user assigned managed identity.</param>
21+ /// <param name="managedIdentityResourceIdFunc ">Resource Identifier if using user assigned managed identity.</param>
2222 /// <returns>Environment Configuration</returns>
2323 /// <exception cref="NotSupportedException">If RuntimeEnvironment is unsupported.</exception>
2424 /// <exception cref="ArgumentException">If AZ is not authenticated.</exception>
@@ -27,7 +27,7 @@ public static EnvironmentConfiguration AddEnvironmentConfiguration(
2727 ConfigurationManager configuration ,
2828 string applicationName ,
2929 string applicationDescription = "N/A" ,
30- ResourceIdentifier ? managedIdentityResourceId = null )
30+ Func < EnvironmentConfiguration , ResourceIdentifier > ? managedIdentityResourceIdFunc = null )
3131 {
3232 var environmentConfiguration =
3333 GetEnvironmentConfiguration ( configuration , applicationName , applicationDescription ) ;
@@ -38,9 +38,9 @@ public static EnvironmentConfiguration AddEnvironmentConfiguration(
3838 {
3939 TenantId = environmentConfiguration . TenantId ,
4040 } ) ,
41- RuntimeEnvironment . Cloud when managedIdentityResourceId is not null => new ManagedIdentityCredential (
42- managedIdentityResourceId ) ,
43- RuntimeEnvironment . Cloud when managedIdentityResourceId is null => new ManagedIdentityCredential ( ) ,
41+ RuntimeEnvironment . Cloud when managedIdentityResourceIdFunc is not null => new ManagedIdentityCredential (
42+ managedIdentityResourceIdFunc ( environmentConfiguration ) ) ,
43+ RuntimeEnvironment . Cloud when managedIdentityResourceIdFunc is null => new ManagedIdentityCredential ( ) ,
4444 RuntimeEnvironment . UnitTest => new TokenCredentialMock ( ) ,
4545 _ => throw new NotSupportedException (
4646 $ "Runtime environment { environmentConfiguration . RuntimeEnvironment } is not supported") ,
0 commit comments