You can use a resistor in series with the led. If you could pass 20mA, this is the normal current for a low power led, then subtract the led voltage from 24, then multiply this figure by 50 to get the resistor value. With a 3V led, 21*50 = 1050, use 1k.
Note that with 24V you have sufficient...