Tutorial: Configure routing preference for a virtual machine

This tutorial shows you how to configure routing preference for a virtual machine. Internet bound traffic from the virtual machine is routed via the ISP network when you choose Internet as your routing preference option. The default routing is via the Microsoft global network.

In this tutorial, you learn how to:

  • Create a virtual machine with a public IP address configured for Internet routing preference.
  • Verify the public IP address is set to Internet routing preference.

Prerequisites

Create virtual machine with a public IP address

In this section, you create a virtual machine and public IP address in the Azure portal. During the public IP address configuration, you select Internet for routing preference.

  1. Sign in to the Azure portal.

  2. In the portal search box, enter Virtual machine. In the search results, select Virtual machines.

  3. In Virtual machines, select + Create, then + Virtual machine.

  4. In the Basics tab of Create a virtual machine, enter, or select the following information.

    Setting Value
    Project details
    Subscription Select your subscription.
    Resource group Select Create new.
    Enter TutorVMRoutePref-rg. Select OK.
    Instance details
    Virtual machine name Enter myVM.
    Region Select (US) West US 2.
    Availability options Select No infrastructure redundancy required.
    Zone options Select Self-selected zone.
    Availability zone Select Zone 1.
    Security type Select Standard.
    Image Select Windows Server 2022 Datacenter: Azure Edition - x64 Gen2.
    Azure Spot instance Leave the default of unchecked.
    Size Select a size.
    Administrator account
    Username Enter a username.
    Password Enter a password.
    Confirm password Reenter password.
    Inbound port rules
    Public inbound ports Select Allow selected ports.
    Select inbound ports Leave the default of RDP (3389).
    Opening port 3389 from the internet is not recommended for production workloads.
  5. Select Next: Disks then Next: Networking, or select the Networking tab.

  6. In the networking tab, enter or select the following information.

    Setting Value
    Network interface
    Virtual network Leave the default of (new) TutorVMRoutePref-rg-vnet.
    Subnet Leave the default of (new) default (10.1.0.0/24).
    Public IP Select Create new.
    In Name, enter myPublicIP.
    In Routing preference, select Internet.
    In Availability zone, select Zone 1.
    Select OK.
  7. Select Review + create.

  8. Select Create.

Verify internet routing preference

In this section, you search for the public IP address previously created and verify the internet routing preference using the Azure portal.

  1. In the portal search box, enter Public IP address. In the search results, select Public IP addresses.

  2. In Public IP addresses, select myPublicIP.

  3. Select Properties in Settings.

  4. Verify Internet is displayed in Routing preference.

    Screenshot of verify internet routing preference.

Clean up resources

If you're not going to continue to use this application, delete the public IP address with the following steps:

  1. In the search box at the top of the portal, enter Resource group.

  2. In the search results, select Resource groups.

  3. Select TutorVMRoutePref-rg

  4. Select Delete resource group.

  5. Enter myResourceGroup for TYPE THE RESOURCE GROUP NAME and select Delete.

Next steps

Advance to the next article to learn how to create a virtual machine with mixed routing preference: