public AzureSessionService(IAzureSessionOptions azureSessionOptions = null, IHttpClientFactory httpClientFactory = null) { this.azureSessionOptions = azureSessionOptions ?? AzureSessionOptions.Default; this.httpClientFactory = httpClientFactory ?? new DefaultHttpClientFactory(); credentials = new Lazy <AzureCredentials>(() => InitCredentials(), LazyThreadSafetyMode.PublicationOnly); session = new Lazy <AZFluent.Azure.IAuthenticated>(() => InitSession(), LazyThreadSafetyMode.PublicationOnly); }
public AzureSessionFactory(IAzureSessionOptions azureSessionOptions) { this.azureSessionOptions = azureSessionOptions ?? throw new ArgumentNullException(nameof(azureSessionOptions)); session = new Lazy <AZFluent.Azure.IAuthenticated>(() => { var credentials = new RMFluent.Authentication.AzureCredentialsFactory() .FromServicePrincipal(azureSessionOptions.ClientId, azureSessionOptions.ClientSecret, azureSessionOptions.TenantId, RMFluent.AzureEnvironment.AzureGlobalCloud); return(AZFluent.Azure .Configure() .Authenticate(credentials)); }); }
public AzureSessionService(IAzureSessionOptions azureSessionOptions = null, IHttpClientFactory httpClientFactory = null) { this.azureSessionOptions = azureSessionOptions ?? AzureSessionOptions.Default; this.httpClientFactory = httpClientFactory ?? new DefaultHttpClientFactory(); }
public static Task <string> AcquireTokenAsync(AzureEndpoint azureEndpoint = AzureEndpoint.ResourceManagerEndpoint, IAzureSessionOptions azureSessionOptions = null, IHttpClientFactory httpClientFactory = null) => new AzureSessionService(azureSessionOptions, httpClientFactory).AcquireTokenAsync(azureEndpoint);