You need your d number to open a bank account, to rent a place to live and to pay your taxes.
When you get a d number depends on your situation.
If you received a d-number when you should have received a national identity number, you must contact the National Registry (external website).
A DUF number is not the same as a d number. The DUF number is your registration number in the computer system of the Norwegian Directorate of Immigration.