You get a número de utente the first time you access a public health unit, or you can proactively request one at any health center even before you need care. You’ll need your ID, NIF, a complete Portuguese address, and valid residency authorization to actually get cost coverage (having the number alone doesn’t guarantee that). It’s free, run by the ACSS.
In the meantime
Many nomads bridge the gap with private insurance — domestic Portuguese insurers (Multicare, Médis, Fidelidade, AdvanceCare) run roughly €30–€150/month depending on age and coverage; international insurers built for visa compliance (Feather, Cigna, AXA) start around €85/month. Your D8 visa insurance needs to cover your full stay and include hospitalization, and gets checked both at the consular stage and again at your AIMA appointment.
Next step: once your address and NIF are sorted, register your número de utente at your local Centro de Saúde — don’t wait for AIMA to finish first, since this can move in parallel.