וְשָׂמַחְתָּ֣ בְכָל־הַטּ֗וֹב אֲשֶׁ֧ר נָֽתַן־לְךָ֛ יְהוָ֥ה אֱלֹהֶ֖יךָ וּלְבֵיתֶ֑ךָ אַתָּה֙ וְהַלֵּוִ֔י וְהַגֵּ֖ר אֲשֶׁ֥ר בְּקִרְבֶּֽךָ׃ (ס)
And thou shalt rejoice in all the good which the LORD thy God hath given unto thee, and unto thy house, thou, and the Levite, and the stranger that is in the midst of thee.
Tosefta Berakhot
Rebbi Meir says, “From where [do we know] that just like you have to bless [God] for good [things that happen to you], so too you have to bless [God] for bad [things that happen to you]? The Torah teaches us, ‘… that which Hashem, your God, has given you …’ (Deuteronomy 26:11). “Your God” [meaning] “your Judge”. For every judgment that He judges you, whether positively or negatively.”