Seems like it should work, though I haven't tried it. I had heard that cedar could be toxic to plants, be a growth preventer like the juglone exuded by black walnut trees. But I went looking and I couldn't find anything to support that. I did find this advertised:
CedarCide YardSafe Lawn & Garden Spray
CedarCide YardSafe is a ready to use spray that attaches to your garden hose for easy application. This is a chemical free, non toxic spray that repels mosquitoes, gnats, flies and other outdoor pests and is safe to use on lawns, shrubs, flowers, patio, gardens (even vegetable gardens.) Active Ingredients: 13% Cedar Oil.
CedarCide YardSafe is a chemical free solution that is safe for children & pets.
It's an advertisement so take it with a grain or three of salt, but it does seem like people are using cedar essence that way.