// TODO: we should try to create using template after new `Azure.ResourceManager.Resource` is available
        //public async Task CreateVm(
        //    string resourceGroupName,
        //    string location,
        //    string virtualMachineName,
        //    string storageAccountName,
        //    string networkInterfaceName,
        //    string networkSecurityGroupName,
        //    string diagnosticsStorageAccountName,
        //    string deploymentName,
        //    string adminPassword)
        //{
        //    string deploymentParams = "{" +
        //        "\"resourceGroupName\": {\"value\": \"" + resourceGroupName + "\"}," +
        //        "\"location\": {\"value\": \"" + location + "\"}," +
        //        "\"virtualMachineName\": { \"value\": \"" + virtualMachineName + "\"}," +
        //        "\"virtualMachineSize\": { \"value\": \"Standard_DS1_v2\"}," +
        //        "\"adminUsername\": { \"value\": \"netanalytics32\"}," +
        //        "\"storageAccountName\": { \"value\": \"" + storageAccountName + "\"}," +
        //        "\"routeTableName\": { \"value\": \"" + resourceGroupName + "RT\"}," +
        //        "\"virtualNetworkName\": { \"value\": \"" + resourceGroupName + "-vnet\"}," +
        //        "\"networkInterfaceName\": { \"value\": \"" + networkInterfaceName + "\"}," +
        //        "\"networkSecurityGroupName\": { \"value\": \"" + networkSecurityGroupName + "\"}," +
        //        "\"adminPassword\": { \"value\": \"" + adminPassword + "\"}," +
        //        "\"storageAccountType\": { \"value\": \"Premium_LRS\"}," +
        //        "\"diagnosticsStorageAccountName\": { \"value\": \"" + diagnosticsStorageAccountName + "\"}," +
        //        "\"diagnosticsStorageAccountId\": { \"value\": \"Microsoft.Storage/storageAccounts/" + diagnosticsStorageAccountName + "\"}," +
        //        "\"diagnosticsStorageAccountType\": { \"value\": \"Standard_LRS\"}," +
        //        "\"addressPrefix\": { \"value\": \"10.17.3.0/24\"}," +
        //        "\"subnetName\": { \"value\": \"default\"}, \"subnetPrefix\": { \"value\": \"10.17.3.0/24\"}," +
        //        "\"publicIpAddressName\": { \"value\": \"" + virtualMachineName + "-ip\"}," +
        //        "\"publicIpAddressType\": { \"value\": \"Dynamic\"}" +
        //        "}";
        //    string templateString = File.ReadAllText(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TestData", "DeploymentTemplate.json"));

        //    DeploymentProperties deploymentProperties = new DeploymentProperties(DeploymentMode.Incremental)
        //    {
        //        Template = templateString,
        //        Parameters = deploymentParams
        //    };
        //    Deployment deploymentModel = new Deployment(deploymentProperties);

        //    Operation<DeploymentExtended> deploymentWait = await resourcesClient.Deployments.CreateOrUpdateAsync(resourceGroupName, deploymentName, deploymentModel);
        //    await deploymentWait.WaitForCompletionAsync();
        //}

        // TODO: we should decide after preview whehter we need to support compute resources like vmss in Network SDK
        //public async Task CreateVmss(ResourcesManagementClient resourcesClient, string resourceGroupName, string deploymentName)
        //{
        //    string templateString = File.ReadAllText(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TestData", "VmssDeploymentTemplate.json"));

        //    DeploymentProperties deploymentProperties = new DeploymentProperties(DeploymentMode.Incremental)
        //    {
        //        Template = templateString
        //    };
        //    Deployment deploymentModel = new Deployment(deploymentProperties);
        //    Operation<DeploymentExtended> deploymentWait = await resourcesClient.Deployments.CreateOrUpdateAsync(resourceGroupName, deploymentName, deploymentModel);
        //    await deploymentWait.WaitForCompletionAsync();
        //}

        public async Task <ExpressRouteCircuit> CreateDefaultExpressRouteCircuit(Resources.ResourceGroup resourceGroup, string circuitName, string location)
        {
            var sku = new ExpressRouteCircuitSku
            {
                Name   = "Premium_MeteredData",
                Tier   = "Premium",
                Family = "MeteredData"
            };

            var provider = new ExpressRouteCircuitServiceProviderProperties
            {
                BandwidthInMbps     = Convert.ToInt32(ExpressRouteTests.Circuit_BW),
                PeeringLocation     = ExpressRouteTests.Circuit_Location,
                ServiceProviderName = ExpressRouteTests.Circuit_Provider
            };

            var circuit = new ExpressRouteCircuitData()
            {
                Location = location,
                Tags     = { { "key", "value" } },
                Sku      = sku,
                ServiceProviderProperties = provider
            };

            // Put circuit
            var circuitCollection = resourceGroup.GetExpressRouteCircuits();
            Operation <ExpressRouteCircuit> circuitOperation = await circuitCollection.CreateOrUpdateAsync(true, circuitName, circuit);

            Response <ExpressRouteCircuit> circuitResponse = await circuitOperation.WaitForCompletionAsync();

            Assert.AreEqual("Succeeded", circuitResponse.Value.Data.ProvisioningState.ToString());
            Response <ExpressRouteCircuit> getCircuitResponse = await circuitCollection.GetAsync(circuitName);

            return(getCircuitResponse);
        }
 public async Task ClearChallengeCacheforRecord()
 {
     if (Mode == RecordedTestMode.Record || Mode == RecordedTestMode.Playback)
     {
         Initialize();
     }
     resourceGroup = (await CreateResourceGroup(Recording.GenerateAssetName("pe_rg")));
 }
        public async Task ClearChallengeCacheforRecord()
        {
            if (Mode == RecordedTestMode.Record || Mode == RecordedTestMode.Playback)
            {
                Initialize();
            }
            _subscription = await ArmClient.GetDefaultSubscriptionAsync();

            resourceGroup = await CreateResourceGroup(Recording.GenerateAssetName(NamePrefix));
        }
 protected NetworkInterfaceCollection GetNetworkInterfaceCollection(Resources.ResourceGroup resourceGroup)
 {
     return(resourceGroup.GetNetworkInterfaces());
 }
 protected VirtualNetworkCollection GetVirtualNetworkCollection(Resources.ResourceGroup resourceGroup)
 {
     return(resourceGroup.GetVirtualNetworks());
 }
 protected LoadBalancerCollection GetLoadBalancerCollection(Resources.ResourceGroup resourceGroup)
 {
     return(resourceGroup.GetLoadBalancers());
 }
        public async Task <ExpressRouteCircuit> UpdateDefaultExpressRouteCircuitWithIpv6MicrosoftPeering(Resources.ResourceGroup resourceGroup, string circuitName)
        {
            var ipv6Peering = new Ipv6ExpressRouteCircuitPeeringConfig()
            {
                PrimaryPeerAddressPrefix   = ExpressRouteTests.MS_PrimaryPrefix_V6,
                SecondaryPeerAddressPrefix = ExpressRouteTests.MS_SecondaryPrefix_V6,
                MicrosoftPeeringConfig     = new ExpressRouteCircuitPeeringConfig()
                {
                    AdvertisedPublicPrefixes =
                    {
                        ExpressRouteTests.MS_PublicPrefix_V6
                    },
                    LegacyMode = Convert.ToInt32(true)
                },
            };

            var peering = new ExpressRouteCircuitPeeringData()
            {
                Name              = ExpressRoutePeeringType.MicrosoftPeering.ToString(),
                PeeringType       = ExpressRoutePeeringType.MicrosoftPeering,
                PeerASN           = Convert.ToInt32(ExpressRouteTests.MS_PeerASN),
                VlanId            = Convert.ToInt32(ExpressRouteTests.MS_VlanId),
                Ipv6PeeringConfig = ipv6Peering
            };

            var circuitCollection = resourceGroup.GetExpressRouteCircuits();
            Operation <ExpressRouteCircuitPeering> peerOperation = await circuitCollection.Get(circuitName).Value.GetExpressRouteCircuitPeerings().CreateOrUpdateAsync(true, ExpressRouteTests.Peering_Microsoft, peering);

            Response <ExpressRouteCircuitPeering> peerResponse = await peerOperation.WaitForCompletionAsync();

            Assert.AreEqual("Succeeded", peerResponse.Value.Data.ProvisioningState.ToString());
            Response <ExpressRouteCircuit> getCircuitResponse = await circuitCollection.GetAsync(circuitName);

            return(getCircuitResponse);
        }
 protected NetworkInterfaceContainer GetNetworkInterfaceContainer(Resources.ResourceGroup resourceGroup)
 {
     return(resourceGroup.GetNetworkInterfaces());
 }
 protected VirtualNetworkContainer GetVirtualNetworkContainer(Resources.ResourceGroup resourceGroup)
 {
     return(resourceGroup.GetVirtualNetworks());
 }
 protected LoadBalancerContainer GetLoadBalancerContainer(Resources.ResourceGroup resourceGroup)
 {
     return(resourceGroup.GetLoadBalancers());
 }