def create_vnet_config(resource_group_name, vnet_name, vnet_subnet_name)
      raise ArgumentError, "GatewaySubnet cannot be used as the name for --azure-vnet-subnet-name option. GatewaySubnet can only be used for virtual network gateways." if vnet_subnet_name == "GatewaySubnet"

      vnet_config = {}
      subnets = nil
      flag = true
      ## check whether user passed or default named virtual network exist or not ##
      vnet = get_vnet(resource_group_name, vnet_name)
      vnet_config[:virtualNetworkName] = vnet_name
      if vnet ## handle resources in the existing virtual network ##
        vnet_config[:addressPrefixes] = vnet_address_spaces(vnet)
        vnet_config[:subnets] = Array.new
        subnets = subnets_list(resource_group_name, vnet_name)
        if subnets
          subnets.each do |subnet|
            flag = false if subnet.name == vnet_subnet_name ## given subnet already exist in the virtual network ##
            ## preserve the existing subnet resources ##
            vnet_config[:subnets].push(
              subnet(subnet.name, subnet_address_prefix(subnet))
            )
          end
        end
      else ## create config for new vnet ##
        vnet_config[:addressPrefixes] = [ "10.0.0.0/16" ]
        vnet_config[:subnets] = Array.new
        vnet_config[:subnets].push(
          subnet(vnet_subnet_name, "10.0.0.0/24")
        )
        flag = false
      end

      ## given subnet does not exist, so create new one in the virtual network ##
      vnet_config = add_subnet(vnet_subnet_name, vnet_config, subnets) if flag

      vnet_config
    end
def create_vnet_config(resource_group_name, vnet_name, vnet_subnet_name)
      raise ArgumentError, "GatewaySubnet cannot be used as the name for --azure-vnet-subnet-name option. GatewaySubnet can only be used for virtual network gateways." if vnet_subnet_name == "GatewaySubnet"

      vnet_config = {}
      subnets = nil
      flag = true
      ## check whether user passed or default named virtual network exist or not ##
      vnet = get_vnet(resource_group_name, vnet_name)
      vnet_config[:virtualNetworkName] = vnet_name
      if vnet ## handle resources in the existing virtual network ##
        vnet_config[:addressPrefixes] = vnet_address_spaces(vnet)
        vnet_config[:subnets] = Array.new
        subnets = subnets_list(resource_group_name, vnet_name)
        if subnets
          subnets.each do |subnet|
            flag = false if subnet.name == vnet_subnet_name ## given subnet already exist in the virtual network ##
            ## preserve the existing subnet resources ##
            vnet_config[:subnets].push(
              subnet(subnet.name, subnet_address_prefix(subnet))
            )
          end
        end
      else ## create config for new vnet ##
        vnet_config[:addressPrefixes] = [ "10.0.0.0/16" ]
        vnet_config[:subnets] = Array.new
        vnet_config[:subnets].push(
          subnet(vnet_subnet_name, "10.0.0.0/24")
        )
        flag = false
      end

      ## given subnet does not exist, so create new one in the virtual network ##
      vnet_config = add_subnet(vnet_subnet_name, vnet_config, subnets) if flag

      vnet_config
    end
virtual network configuration creation for the new vnet creation or to
 handle existing vnet