/// <summary>
 /// Initializes a new instance of the <see cref="ExtendedAzureResourceManagerClient"/> class
 /// </summary>
 /// <param name="httpClientWrapper">The HTTP client wrapper</param>
 /// <param name="credentialsFactory">The credentials factory</param>
 /// <param name="tracer">The tracer</param>
 public ExtendedAzureResourceManagerClient(IHttpClientWrapper httpClientWrapper, ICredentialsFactory credentialsFactory, ITracer tracer)
 {
     this.httpClientWrapper = Diagnostics.EnsureArgumentNotNull(() => httpClientWrapper);
     Diagnostics.EnsureArgumentNotNull(() => credentialsFactory);
     this.baseUri     = new Uri(ConfigurationManager.AppSettings["ResourceManagerBaseUri"] ?? "https://management.azure.com/");
     this.credentials = credentialsFactory.CreateAzureCredentials(ConfigurationManager.AppSettings["ResourceManagerCredentialsResource"] ?? "https://management.azure.com/");
     this.tracer      = Diagnostics.EnsureArgumentNotNull(() => tracer);
     this.tracer      = tracer;
     this.retryPolicy = Policy
                        .Handle <CloudException>(ex => ex.Request != null && (ex.Response.StatusCode >= HttpStatusCode.InternalServerError || ex.Response.StatusCode == HttpStatusCode.RequestTimeout))
                        .WaitAndRetryAsync(
         3,
         (i) => TimeSpan.FromSeconds(Math.Pow(2, i)),
         (exception, span, context) => tracer.TraceError($"Failed accessing DependencyName on {exception.Message}, retry {Math.Log(span.Seconds, 2)} out of 3"));
     this.httpRetryPolicy = PolicyExtensions.CreateTransientHttpErrorPolicy(this.tracer, DependencyName);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MetricClient"/> class
 /// </summary>
 /// <param name="tracer">The tracer</param>
 /// <param name="credentialsFactory">The credentials factory</param>
 public MetricClient(ITracer tracer, ICredentialsFactory credentialsFactory)
     : this(tracer, new MonitorManagementClient(RestClient.Configure()
                                                .WithEnvironment(AzureEnvironment.AzureGlobalCloud)
                                                .WithCredentials(credentialsFactory.CreateAzureCredentials("https://management.azure.com/")).Build()))
 {
 }