After 5 years of uninterrupted legal residence in Denmark, you may apply for permanent residence.
Fill in the application beforehand and attend the Danish Agency for International Recruitment and Integration (SIRI). They will assist you in the process.
You must bring a number of documents to apply for the certificate of right to permanent residence. It is a good idea to gather the necessary documents before you start completing the application form.