Attempting to create a UDR route using "-AddressPrefix VirtualNetwork" results in error

GavinS 6 Reputation points
2022-04-25T12:33:31.083+00:00

Hi Azure team,

There appears to be a bug / missing feature in "Virtual network service tags" for User-Defined Routes

According to the table on page https://learn.microsoft.com/en-us/azure/virtual-network/service-tags-overview#available-service-tags , "VirtualNetwork" is a valid service tag that should be usable in UDR static routes, however I receive the following error every time I try to use it.

Set-AzRouteTable: C:\Scripts\Powershell\Azure\DC\Azure_Build_xxx_v10.ps1:1314:19
Line |
1314 | $RouteTable | Set-AzRouteTable
| ~~~~~~~~~~~~~~~~
| Address prefix VirtualNetwork of resource
| /subscriptions/a9xxxxxxx/resourceGroups/RG_DC_002_westeurope/providers/Microsoft.Network/routeTables/UDR_NET_FW-HA-02/routes/VirtualNetwork is not formatted
| correctly. It should follow CIDR notation, for example 10.0.0.0/24. StatusCode: 400 ReasonPhrase: Bad Request ErrorCode: InvalidAddressPrefixFormat ErrorMessage: Address prefix
| VirtualNetwork of resource
| /subscriptions/a9xxxxxxx/resourceGroups/RG_DC_002_westeurope/providers/Microsoft.Network/routeTables/UDR_NET_FW-HA-02/routes/VirtualNetwork is not formatted
| correctly. It should follow CIDR notation, for example 10.0.0.0/24. OperationID : c0d8805f-94c1-4684-88f8-89be133b2ad9

The command causing the error is the following:
Add-AzRouteConfig -Name "VirtualNetwork" -AddressPrefix "VirtualNetwork" -NextHopType "None" -RouteTable $RouteTable

By comparison, if I use a different service tag, it works correctly, e.g.
Add-AzRouteConfig -Name "StorageRoute" -AddressPrefix "Storage" -NextHopType "None" -RouteTable $RouteTable

According to the URL at the top of the post:
"Note: As of March 2022, using service tags in place of explicit address prefixes in user defined routes is out of preview and generally available."

With that in mind, can you please advise:
A. why using the service tag "VirtualNetwork" (i.e. -AddressPrefix "VirtualNetwork") is not working?
B. when it will be implemented (in my case, specifically in westeurope and northeurope)

[ Note: using -AddressPrefix "VirtualNetwork" is exactly what I want to do in a number of UDRs, so it is an important issue to correct ]

Many thanks!

Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,762 questions
{count} vote

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.