def add_subnet(subnet_name, vnet_config, subnets)
      new_subnet_prefix = nil
      vnet_address_prefix_count = 0
      vnet_address_space = vnet_config[:addressPrefixes]

      ## search for space in all the address prefixes of the virtual network ##
      while new_subnet_prefix.nil? && vnet_address_space.length > vnet_address_prefix_count
        new_subnet_prefix = new_subnet_address_prefix(
          vnet_address_space[vnet_address_prefix_count],
          subnets_list_for_specific_address_space(
            vnet_address_space[vnet_address_prefix_count], subnets
          )
        )
        vnet_address_prefix_count += 1
      end

      if new_subnet_prefix ## found space for new subnet ##
        vnet_config[:subnets].push(
          subnet(subnet_name, new_subnet_prefix)
        )
      else ## no space available in the virtual network for the new subnet ##
        raise "Unable to add subnet #{subnet_name} into the virtual network #{vnet_config[:virtualNetworkName]}, no address space available !!!"
      end

      vnet_config
    end
def add_subnet(subnet_name, vnet_config, subnets)
      new_subnet_prefix = nil
      vnet_address_prefix_count = 0
      vnet_address_space = vnet_config[:addressPrefixes]

      ## search for space in all the address prefixes of the virtual network ##
      while new_subnet_prefix.nil? && vnet_address_space.length > vnet_address_prefix_count
        new_subnet_prefix = new_subnet_address_prefix(
          vnet_address_space[vnet_address_prefix_count],
          subnets_list_for_specific_address_space(
            vnet_address_space[vnet_address_prefix_count], subnets
          )
        )
        vnet_address_prefix_count += 1
      end

      if new_subnet_prefix ## found space for new subnet ##
        vnet_config[:subnets].push(
          subnet(subnet_name, new_subnet_prefix)
        )
      else ## no space available in the virtual network for the new subnet ##
        raise "Unable to add subnet #{subnet_name} into the virtual network #{vnet_config[:virtualNetworkName]}, no address space available !!!"
      end

      vnet_config
    end
add new subnet into the existing virtual network