Per 5th edition rules.

Whenever a attack roll is required.

So, scorching ray for example. One spell. attack roll per ray. each RAY gets a application of hex.