code: func (as *availabilitySet) getAgentPoolAvailabiliySets(nodes []*v1.Node) (agentPoolAvailabilitySets *[]string, err error) {
  	vms, err := as.ListVirtualMachines(as.ResourceGroup)
  	if err != nil {
  		klog.Errorf("as.getNodeAvailabilitySet - ListVirtualMachines failed, err=%v", err)
  		return nil, err
  	}
  	vmNameToAvailabilitySetID := make(map[string]string, len(vms))
  	for vmx := range vms {
  		vm := vms[vmx]
  		if vm.AvailabilitySet != nil {
  			vmNameToAvailabilitySetID[*vm.Name] = *vm.AvailabilitySet.ID
  		}
  	}
  	availabilitySetIDs := sets.NewString()
  	agentPoolAvailabilitySets = &[]string{}
  	for nx := range nodes {
  		nodeName := (*nodes[nx]).Name
  		if isMasterNode(nodes[nx]) {
  			continue
  		}
  		asID, ok := vmNameToAvailabilitySetID[nodeName]
  		if !ok {
  			klog.Errorf("as.getNodeAvailabilitySet - Node(%s) has no availability sets", nodeName)
  			return nil, fmt.Errorf("Node (%s) - has no availability sets", nodeName)
  		}
  		if availabilitySetIDs.Has(asID) {
  			// already added in the list
  			continue
  		}
  		asName, err := getLastSegment(asID)
  		if err != nil {
  			klog.Errorf("as.getNodeAvailabilitySet - Node (%s)- getLastSegment(%s), err=%v", nodeName, asID, err)
  			return nil, err
  		}
  		// AvailabilitySet ID is currently upper cased in a indeterministic way
  		// We want to keep it lower case, before the ID get fixed
  		asName = strings.ToLower(asName)
  
  		*agentPoolAvailabilitySets = append(*agentPoolAvailabilitySets, asName)
  	}
  
  	return agentPoolAvailabilitySets, nil
  }
docs: // getAgentPoolAvailabiliySets lists the virtual machines for the resource group and then builds
  // a list of availability sets that match the nodes available to k8s.