Редактиране

Споделяне чрез


Configure virtual hub routing preference - Azure PowerShell

The following steps help you configure virtual hub routing preference settings using Azure PowerShell. You can also configure these settings using the Azure portal. For information about this feature, see Virtual hub routing preference.

Prerequisite

If you're using Azure PowerShell locally from your computer, verify that your az.network module version is 4.19.0 or above.

Configure

To configure virtual hub routing preference for an existing virtual hub, use the following steps.

  1. (Optional) Check the current HubRoutingPreference for an existing virtual hub.

    Get-AzVirtualHub -ResourceGroupName "[resource group name]" -Name "[virtual hub name]" | select-object HubRoutingPreference
    
  2. Update the current HubRoutingPreference for an existing virtual hub. The preference can be either VpnGateway, or ExpressRoute. The following example sets the hub routing preference to VpnGateway.

     Update-AzVirtualHub -ResourceGroupName "[resource group name]" -Name "[virtual hub name]" -HubRoutingPreference "VpnGateway"
    
  3. After the settings have saved, you can verify the configuration by running the following PowerShell command for virtual hub.

    Get-AzVirtualHub -ResourceGroupName "[resource group name]" -Name "[virtual hub name]" |  select-object HubRoutingPreference
    

Next steps

To learn more about virtual hub routing preference, see About virtual hub routing preference.