we will configure the Traffic Manager to direct traffic to the closest instanced based on latency.
Step 1: Create a Traffic Manager Profile
In the Azure portal, navigate to Traffic Manager
Click Create a Traffic Manager Profile. or at the bottom of the portal click New, click Network Services, click Traffic Manager, then click Quick Createto begin configuring your profile.
Configure the DNS prefix. Give your traffic manager profile a unique DNS prefix name. You can specify only the prefix for a Traffic Manager domain name. Select the appropriate subscription and select the load balancing method. Select the load balancing method. For more information about load balancing methods, see About Traffic Manager Load Balancing Methods. and Click “Create” to create your new profile.
When the profile configuration has completed, you can find the newly created profile in the Traffic Manager pane in the Management Portal
Step 2: Add a Cloud Service or Website Endpoint to the Profile
In the portal in the Traffic Manager page , click the Endpoints tab to view the endpoints
At the bottom of the page, click Addto access the Add Service Endpoints dialogue box. It will lists the cloud services in your subscription under Service Endpoints. In our case we are running our App in VMs contained by Cloud Service. So we will select the cloud services in the list to enable them as endpoints for this profile. If we had Azure websites, we would click the Service Type dropdown, and then select Website.
After you select the endpoints for this profile, click the checkmark on the lower right to save your changes.
In the configure tab, you will find the DNS Name you gave your profile (in case you forgot what you entered)
To point your company domain name to a Traffic Manager domain name, modify the DNS resource record on your Internet DNS server to use the CNAME record type, which maps your company domain name to the domain name of your Traffic Manager profile. for example:
www.contoso.com IN CNAME canitprocampapp.trafficmanager.net
Step 3: Test the Profile
To test our profile I connected to all my VMs and edited the logo on each server to show a specific tag
1 and 2 are the 2 instances in the “East US” zone, Central 1 and 2 are in the “Central US” zone.
To create a VNet by using the Azure portal, follow the steps below. Note that the screenshots are provided as examples. Be sure to replace the values with your own. For more information about working with virtual networks, see the Virtual Network Overview.
From a browser, navigate to the Azure portal and, if necessary, sign in with your Azure account.
Click New>Networking>Virtual Network.
Near the bottom of the Virtual Network blade, from the Select a deployment model list, select Resource Manager, and then click Create.
On the Create virtual network blade, configure the VNet settings. In this blade, you'll add your first address space and a single subnet address range. After you finish creating the VNet, you can go back and add additional subnets and address spaces. This is a current limitation of the portal. You can always come back to update these values by editing the VNet properties in the portal, or by using PowerShell. The values that you use will depend on the configuration you want to create. Be sure to refer to your planned configuration values.
Verify that the Subscription is the correct one. You can change subscriptions by using the dropdown.
Click Resource group and either select an existing resource group, or create a new one by typing a name for your new resource group. If you are creating a new group, name the resource group according to your planned configuration values. For more information about resource groups, visit Azure Resource Manager Overview.
Next, select the Location settings for your VNet. Note that the location will determine where the resources that you deploy to this VNet will reside. You can't change this later without redeploying your resources.
Select Pin to dashboard if you want to be able to find your VNet easily on the dashboard, and then click Create.
After clicking Create, you will see a tile on your dashboard that will reflect the progress of your VNet. The tile will change as the VNet is being created.
2. Add additional address space and subnets
You can add additional address space and subnets to your VNet once it has been created.
To add address space
To add additional address space, click All settings to open the Settings blade.
On the Settings blade, click Address space to open the Address space blade. Add the additional address space in this blade, and then click Save at the top of the blade.
To add subnets
To add additional subnets to your address spaces, in the Settings blade, click Subnets to open the Subnets blade.
In the Subnets blade, click Add to open the Add subnet blade. Name your new subnet and specify the address range, and then click OK at the bottom of the blade. Once a subnet has been created, you can use the subnets blade to view all of your subnets for a VNet.
3. Specify a DNS server
If you are creating this configuration as an exercise, refer to these values when specifying your DNS server.
To specify a DNS server
This setting allows you to specify the DNS server that you want to use for name resolution for this virtual network. It does not create a DNS server.
On the Settings page for your virtual network, navigate to DNS Servers and click to open the DNS servers blade.
On the DNS Servers page, under DNS servers, select Custom DNS.
In the Primary DNS server field, enter the IP address of the DNS server that you want to use for name resolution.
Click Save at the top of the blade to save your configuration.
4. Create a gateway subnet
Before connecting your virtual network to a gateway, you first need to create the gateway subnet for the virtual network to which you want to connect. The gateway subnet you create must be named GatewaySubnet or it won't work properly.
The gateway subnet prefix for some configurations requires a subnet of /28 or larger to accommodate the number of IP addresses needed in the pool. This means the gateway subnet prefix needs to be /28, /27, /26 etc. You may want to create a larger subnet here to accommodate possible future configuration additions.
If you are creating this configuration as an exercise, refer to these values when creating your gateway subnet.
To create a gateway subnet
Warning:
Associating a Network Security Group (NSG) to the GatewaySubnet will cause your VPN gateway to stop functioning as expected. DO NOT associate NSGs to Gateway subnets.
In the portal, navigate to the virtual network to which you want to connect a gateway.
In the Settings section of your VNet blade, click Subnets to expand the Subnets blade.
On the Subnets blade, click +Gateway subnet at the top. This will open the Add subnetblade. The Name for your subnet will automatically be filled in with the value 'GatewaySubnet'. This value is required in order for Azure to recognize the subnet as the gateway subnet.
You can change the address range CIDR block if necessary. Check the specific requirements for your configuration to confirm the recommended CIDR block.
Click OK at the bottom of the blade to create the subnet.
5. Create a virtual network gateway
If you are creating this configuration as an exercise, refer to these values when creating your gateway.
To create a virtual network gateway
In the portal, go to New > Networking > Virtual network gateway. This will open theCreate virtual network gateway blade.
On the Create virtual network gateway blade, in the Name field, name your gateway. This is not the same as naming a gateway subnet. It's the name of the gateway object you will be creating.
Adjust the Location field to point to the location where your virtual network is located. If you don't do this, the VNet list will not show your virtual network.
Next, choose the virtual network to which you want to add this gateway. Click Virtual network to open the Choose a virtual network blade. Select the VNet. In order for the VNet to appear in the list, it must already have a valid gateway subnet.
Choose a public IP address. Click Public IP address to open the Choose public IP addressblade. Click +Create New to open the Create public IP address blade. Input a name for your public IP address. This will create a public IP address object to which a public IP address will be dynamically assigned. Click OK to save your changes.
For Gateway type, select the Gateway type that is specified for your configuration.
For VPN type, select the VPN type that is specified for your configuration.
For Subscription, verify that the correct subscription is selected.
The Resource group is determined by the Virtual Network that you select.
Don't adjust the Location after you've specified the settings above.
At this point, your blade will look similar to the graphic in step 1. Verify that the settings match the settings for your own configuration. You can select Pin to dashboard at the bottom of the blade if you want your gateway to appear on the dashboard.
Click Create to begin creating the gateway. The settings will be validated and you'll see the "Deploying Virtual network gateway" tile on the dashboard. Creating a gateway can take up to 45 minutes. You may need to refresh your portal page to see the completed status.
After the gateway is created, you can view the IP address that has been assigned to it by looking at the virtual network in the portal. The gateway will appear as a connected device. You can click on the connected device (your virtual network gateway) to view more information.
6. Create a local network gateway
The local network gateway refers to your on-premises location. Give the local network gateway a name by which Azure can refer to it.
If you are creating this configuration as an exercise, refer to these values when adding your local site.
To create a local network gateway
In the portal, navigate to New > Networking > Local network gateway.
On the Create local network gateway blade, specify a Name for your local network gateway object.
Specify a valid public IP address for the VPN device or virtual network gateway to which you want to connect. If this local network represents an on-premises location, this is the public IP address of the VPN device that you want to connect to. It cannot be behind NAT and has to be reachable by Azure. If this local network represents another VNet, you will specify the public IP address that was assigned to the virtual network gateway for that VNet.
Address Space refers to the address ranges for the network that this local network represents. You can add multiple address space ranges. Make sure that the ranges you specify here do not overlap with ranges of other networks that you want to connect to.
For Subscription, verify that the correct subscription is showing.
For Resource Group, select the resource group that you want to use. You can either create a new resource group, or select one that you have already created.
For Location, select the location that this object will be created in. You may want to select the same location that your VNet resides in, but you are not required to do so.
Click Create to create the local network gateway.
7. Configure your VPN device
To configure your VPN device, you'll need the public IP address of the virtual network gateway for configuring your on-premises VPN device. Work with your device manufacturer for specific configuration information and configure your device. Refer to the VPN Devices for more information about VPN devices that work well with Azure.
To find the public IP address of your virtual network gateway using PowerShell, use the following sample:
You can also view the public IP address for your virtual network gateway by using the Azure portal. Navigate to Virtual network gateways, then click the name of your gateway.
8. Create a Site-to-Site VPN connection
Create the Site-to-Site VPN connection between your virtual network gateway and your VPN device. Be sure to replace the values with your own. The shared key must match the value you used for your VPN device configuration.
Before beginning this section, verify that your virtual network gateway and local network gateways have finished creating. If you are creating this configuration as an exercise, refer to these values when creating your connection.
To create the VPN connection
Locate your virtual network gateway and click All settings to open the Settings blade.
On the Settings blade, click Connections, and then click Add at the top of the blade to open the Add connection blade.
On the Add connection blade, Name your connection.
For Connection type, select Site-to-site(IPSec).
For Virtual network gateway, the value is fixed because you are connecting from this gateway.
For Local network gateway, click Choose a local network gateway and select the local network gateway that you want to use.
For Shared Key, the value here must match the value that you are using for your local VPN device. If your VPN device on your local network doesn't provide a shared key, you can make one up and input it here and on your local device. The important thing is that they both match.
The remaining values for Subscription, Resource Group, and Location are fixed.
Click OK to create your connection. You'll see Creating Connection flash on the screen.
When the connection is complete, you'll see it appear in the Connections blade for your Gateway.
9. Verify the VPN connection
You can verify your VPN connection either in the portal, or by using PowerShell.
To verify your connection by using PowerShell
You can verify that your connection succeeded by using the Get-AzureRmVirtualNetworkGatewayConnection cmdlet, with or without -Debug.
Use the following cmdlet example, configuring the values to match your own. If prompted, select 'A' in order to run 'All'. In the example, -Name refers to the name of the connection that you created and want to test.
After the cmdlet has finished, view the values. In the example below, the connection status shows as 'Connected' and you can see ingress and egress bytes.
To verify your connection by using the Azure portal
In the Azure portal, you can view the connection status by navigating to the connection. There are multiple ways to do this. Below is one way to navigate to your connection.
In the Azure portal, navigate to Virtual network gateways. Click your gateway name.
In the pane, under Settings, click Connections. You can see the status of each connection.
For more information about the connection, click the name of the connection. In the Essentials page for your connection, pay attention to the Connection Status. The status will be 'Succeeded' and 'Connected' when you have made a successful connection. You can check the data flowing through by looking at Data in and Data out.
In the example below, the Connection Status is 'Not connected'.