```ruby
class ManageIQ::Providers::Azure::NetworkManager::SecurityGroup < ::SecurityGroup
  has_many :vms, -> { distinct }, :through => :network_ports, :source => :device, :source_type => 'VmOrTemplate'
end
```

Remove N+1 queries from NetworkManager list pages
user
```ruby
class ManageIQ::Providers::Azure::NetworkManager::SecurityGroup < ::SecurityGroup
end
```
assistant