Azure-Samples / azure-samples-python-management

This repo contains sample code for management libraries of Azure SDK for Python
MIT License
154 stars 131 forks source link

Use of route_tables.begin_create_or_update yields removal of all routes and adds new entry #148

Closed erniedavisAA closed 2 months ago

erniedavisAA commented 2 months ago

using the sdk for creating vnets and subnets in azure, and when adding a new route table entry, the new route table entry removed all existsing routes and added the new route to the route table.

The expected behavior would be to add another entry to the route table, rather than replace the route table contents with a single entry.

here is the sample code...

        routeTableResponse = network_client.route_tables.begin_create_or_update(
        resource_group_name=rgname,
        route_table_name=rtname,
        parameters={
          "location": region,
          "properties": {
            "disableBgpRoutePropagation": False, 
            "routes": [
              {
                "name": newvnetname,
                "properties": { 
                    "addressPrefix": newvnetprefix, 
                    "nextHopType": "VirtualAppliance", 
                    "nextHopIpAddress": hublbipaddress} 
              }
            ],
          }
        }
    ).result()