Portugal struggle to narrow qualifying win over Azerbaijan