protected void EnsureClientsInitialized(bool useSPN = false) { if (!m_initialized) { lock (m_lock) { if (!m_initialized) { var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; if (useSPN) { m_ResourcesClient = ComputeManagementTestUtilities.GetResourceManagementClientWithSpn(handler); m_CrpClient = ComputeManagementTestUtilities.GetComputeManagementClientWithSpn(handler); m_SrpClient = ComputeManagementTestUtilities.GetStorageManagementClientSpn(handler); m_NrpClient = ComputeManagementTestUtilities.GetNetworkResourceProviderClientSpn(handler); } else { m_ResourcesClient = ComputeManagementTestUtilities.GetResourceManagementClient(handler); m_CrpClient = ComputeManagementTestUtilities.GetComputeManagementClient(handler); m_SrpClient = ComputeManagementTestUtilities.GetStorageManagementClient(handler); m_NrpClient = ComputeManagementTestUtilities.GetNetworkResourceProviderClient(handler); } m_subId = m_CrpClient.Credentials.SubscriptionId; m_location = ComputeManagementTestUtilities.DefaultLocation; } } } }