The Federal Central Tax Office (BZSt) will assign you your ID number as soon as the registration office has transmitted the required data to the BZSt.
So after you register for the first time in Germany your tax ID will be sent to you automatically.
If after three months you have not yet been given an ID number, you can provide the BZSt with your personal data (name, first name, address (street, house number, postal code, city), date of birth, place of birth). The BZSt will then contact the registration office and provide you with the ID number.
Here you will find further information on the Tax ID: Questions and answers on the Tax ID No.