This post was originally published here.
I continued my search within the Logic Apps Workflow Definition Language and found the @take function. This is what the documentation states:
This did the trick. It takes the first 5000 items from an array. Luckily, you do not get an out-of-range exception if the incoming array contains less items!
It’s always a good practice to validate your design upfront against the Logic Apps limits.
Hope this helps!