The Moroccan dirham (MAD) is a closed currency — banks outside Morocco rarely stock it, and rates abroad are poor. Wait until you land: every major airport has licensed exchange bureaux and ATMs both before and after passport control, with rates that are generally better than what you'd get at home.
Keep every exchange receipt. Officially, you can only convert leftover dirhams back into euros or dollars (up to 50% of what you originally exchanged) if you can show those receipts on departure — cash without proof may just get stuck in-country.
ATMs are the easiest way to get cash day-to-day and are widely available in cities; just notify your bank before you travel so foreign withdrawals aren't flagged and blocked.