Yes, it is one of the most popular yucca species for indoor use. It adapts well to indoor light (bright, indirect is best) and tolerates dry air. Growth will be slower, and it is very unlikely to flower indoors.
How cold hardy is it?
It is the least cold-hardy common yucca, tolerating only brief dips to about 28-30°F (-2 to -1°C). it needs a very warm, protected microclimate or should be grown in a container that can be moved indoors during freezing weather.