You are getting that pipeline error on hitting debug because, you are trying to access the output (@activity('Get Project Data').output[0].resourceIdentifier) outside the for each loop as part of a set variable activity. You will need to move that set variable activity inside of the for each loop for it to be able to access it.
The output of inner activity inside the for each loop has to be persisted somewhere for every iteration (either write the output to a variable and keep appending or persist to some type of storage). This is the only way you can access all of that output in one go outside the for each loop.
Some other ways I would try:
- Use an external call transformation in ADF mapping data flow. Send the 3500 Id's in row by row manner. It will spit out output for all 3500 Ids in row by row manner.
- Check if the API end point can accept a batch of Id's and provide you the output for all those batch of Id's at the same time.
Hope it helps!