Should I apply for NIF before renewing my Passport?

I am planning to apply for a D7 Visa in Portugal. The first step would be to get a NIF.

I am also renewing my Indian passport for exhaustion of pages.
Should I renew the Passport and then apply for NIF or can I do both of them in Parallel if I always present both passports together?