make a virtue of necessity
US /meɪk ə ˈvɜrtʃu əv nəˈsesɪti/
UK /meɪk ə ˈvɜrtʃu əv nəˈsesɪti/

1.
to make the best of a difficult or unpleasant situation by pretending that one has chosen it or that it is a good thing
:
•
We had to cancel our vacation, so we decided to make a virtue of necessity and explore local attractions instead.
•
Even though he didn't get the promotion, he tried to make a virtue of necessity by focusing on new opportunities in his current role.