You have a period of one year. In principle, no one may drive on public roads without a valid Moroccan driving licence corresponding to the vehicle's category (art. 1).
However, the law provides for an exception depending on your situation (art. 2):
- Moroccans residing abroad: you may drive in Morocco for a maximum period of one year from the date you take up residence in Morocco, using your valid foreign licence.
- Foreigners: you may drive with your valid foreign licence, but for a maximum period of one year from the start of your temporary stay in Morocco, within the framework set by the regulations on the entry and stay of foreigners.
Beyond that year (art. 3), you have two options:
- sit the tests to obtain the Moroccan licence;
- apply for the exchange of your licence, if Morocco is bound to your country by an agreement on the mutual recognition of licences, or if your State recognises the exchange of the Moroccan licence.
Note also that if you hold an international driving permit and you are a foreign national, you may drive for the duration of its validity, without however exceeding the same one-year limit (art. 4).
This is general legal information, not legal advice. For advice on your specific situation, consult a lawyer admitted to the Bar in Morocco.