protected override void Clone(ServiceClient <ExpressRouteManagementClient> client)
        {
            base.Clone(client);
            ExpressRouteManagementClient management = client as ExpressRouteManagementClient;

            if (management != null)
            {
                management._credentials = Credentials;
                management._baseUri     = BaseUri;
                management.Credentials.InitializeServiceClient(management);
            }
        }
        public static ExpressRouteManagementClient GetSecondCustomerExpressRouteManagementClient()
        {
            string managementCertificate = "";
            string baseUri;
            string subscriptionId;
            if (HttpMockServer.Mode == HttpRecorderMode.Playback)
            {
                baseUri = HttpMockServer.Variables["TEST_CUSTOMER2_BASE_URI"];
                subscriptionId = HttpMockServer.Variables["TEST_CUSTOMER2_SUBSCRIPTION_ID"];
                managementCertificate = HttpMockServer.Variables["TEST_CUSTOMER2_MANAGEMENT_CERTIFICATE"];
            }
            else
            {
                string publishSettingsFile = Environment.GetEnvironmentVariable("TEST_CUSTOMER2_PUBLISHSETTINGS_FILE");
                PublishData publishData = XmlSerializationHelpers.DeserializeXmlFile<PublishData>(publishSettingsFile);
                managementCertificate = Enumerable.First<PublishDataPublishProfile>((IEnumerable<PublishDataPublishProfile>) publishData.Items).ManagementCertificate;
                if (string.IsNullOrEmpty(managementCertificate))
                    managementCertificate = Enumerable.First<PublishDataPublishProfileSubscription>((IEnumerable<PublishDataPublishProfileSubscription>) Enumerable.First<PublishDataPublishProfile>((IEnumerable<PublishDataPublishProfile>) publishData.Items).Subscription).ManagementCertificate;
                if (string.IsNullOrEmpty(managementCertificate))
                    throw new ArgumentException(string.Format("{0} is not a valid publish settings file, you must provide a valid publish settings file in the environment variable {1}", (object) publishSettingsFile, (object) "TEST_PUBLISHSETTINGS_FILE"));
                
                
                subscriptionId = Enumerable.First<PublishDataPublishProfileSubscription>((IEnumerable<PublishDataPublishProfileSubscription>) Enumerable.First<PublishDataPublishProfile>((IEnumerable<PublishDataPublishProfile>) publishData.Items).Subscription).Id;
                
                baseUri =  Enumerable.First<PublishDataPublishProfileSubscription>(
                        (IEnumerable<PublishDataPublishProfileSubscription>)
                        Enumerable.First<PublishDataPublishProfile>(
                            (IEnumerable<PublishDataPublishProfile>) publishData.Items).Subscription)
                              .ServiceManagementUrl ?? publishData.Items[0].Url;

                HttpMockServer.Variables["TEST_CUSTOMER2_MANAGEMENT_CERTIFICATE"] = managementCertificate;
                HttpMockServer.Variables["TEST_CUSTOMER2_SUBSCRIPTION_ID"] = subscriptionId;
                HttpMockServer.Variables["TEST_CUSTOMER2_BASE_URI"] = baseUri;
            }

            var credentials = new CertificateCloudCredentials(subscriptionId, new X509Certificate2(Convert.FromBase64String(managementCertificate), string.Empty));
            var client = new ExpressRouteManagementClient(credentials, new Uri(baseUri));
            client.AddHandlerToPipeline(HttpMockServer.CreateInstance());
            return client;
        }
 /// <summary>
 /// Creates new ExpressRouteClient
 /// </summary>
 /// <param name="subscription">Subscription containing websites to manipulate</param>
 /// <param name="logger">The logger action</param>
 public ExpressRouteClient(WindowsAzureSubscription subscription)
 {
     Client = subscription.CreateClient<ExpressRouteManagementClient>();
 }
 public ExpressRouteClient(ExpressRouteManagementClient client)
 {
     Client = client;
 }
 /// <summary>
 /// Creates new ExpressRouteClient
 /// </summary>
 /// <param name="subscription">Subscription containing websites to manipulate</param>
 public ExpressRouteClient(AzureSubscription subscription)
 {
     Client = AzureSession.ClientFactory.CreateClient<ExpressRouteManagementClient>(subscription, AzureEnvironment.Endpoint.ServiceManagement);
 }