The core distinction running through these sources is between halakhic rulings derived through the authorized tradition of the Sages and the broader genre of aggadic or homiletical midrash: Devarim 17:10-11 commands following the rulings of the judges of each generation, and Sifrei Devarim 154:2-4 explains that this obligates obedience even to rabbinic enactments, distinguishing the proscriptive and prescriptive commandments embedded in that pasuk.
Sefer HaMitzvot, Positive Commandments 174 codifies this as a binding mitzvah to obey the Great Court in whatever they rule, whether from reasoned legal inference or from matters they agree constitute Torah law, grounding this in the same verse cited by the Sifrei.
Jerusalem Talmud Sanhedrin 4:2 frames the halakhic process itself as intentionally left undetermined by the Torah so that it could be derived through the majority-rule mechanism of the Sages across forty-nine facets, which Sefer HaIkkarim, Maamar 3 23:3-5 develops further: the oral law supplies interpretive principles because a written text alone cannot anticipate every new circumstance, so the wise of each generation work out the details through the thirteen hermeneutical rules.
Against treating all midrashic derivation as legally authoritative, Guide for the Perplexed, Part 3 43:11 states that many midrashic explanations, such as those given for the four species, use the biblical text as a kind of poetic language rather than as its literal meaning, and that opinions differ as to whether such midrashim represent the actual meaning of the verse or whether they should not be taken as literal interpretation at all.
Shabbat 63a:13-14 and Sfas Emes al HaShas, Shabbat 63a preserve the principle that a verse does not depart from its plain sense even when the Sages apply it homiletically to Torah matters, indicating that an aggadic application does not displace the pasuk's literal meaning or establish it as the operative halakhic reading.
Bava Kamma 60b:13-15 shows the Gemara itself drawing combined halakhic and aggadic lessons from the same verse, while Kiddushin 49a:13-14 and Bekhorot 6b:3-5 show Tannaim disputing which category—halakhot or derash—a given term or label actually falls under, indicating that midrash and halakhah were not treated as automatically identical categories even by the Sages themselves.
Sanhedrin 5b:8-9 records that practical halakhic rulings required the discipline of precise transmission and permission from one's teacher, underscoring that teaching binding halakhah demanded a controlled chain of authority distinct from open-ended exposition.
Or HaChaim on Vayikra 26:3 affirms that scholars are given latitude to interpret and derive novel readings of the Torah in many ways, provided a learned student innovates according to what the text can bear, which licenses creative derash even as it still operates within a disciplined framework.
Rav Mordechai Eliyahu (Maamar Mordechai Hilchot Chanukah 2:16) distinguishes the public midrash sessions instituted to teach the people God's statutes as meant primarily to convey practical halachot of Shabbat, Pesach, and the forbidden and permitted, with aggadic material serving to draw the listeners toward fear of Heaven and repentance rather than to establish law of its own accord.
Mishneh Halachos (Mishneh Halachos 10:250) rules directly on the question, holding that midrashic interpretations may be studied and used for aggadic insight, but that halakhic obligations and prohibitions may not be derived independently from Scripture or narrative; only interpretations transmitted through Chazal and fixed in the Talmud and halakhic tradition are binding, and even some aggadic material does not serve as a source for practical law.
Rav Ovadia Yosef (Maayan Omer 12:2:49) likewise cites a Yerushalmi ruling that halakhah is learned from the Talmud and not from aggadot or toseftot, reinforcing that midrashic or aggadic statements are not treated as an independent binding source of practical halakhah.
On the devotional side, Nefesh HaChayim, Gate IV 2:1 and Tanya, Part I; Likkutei Amarim 5:4-5 speak of halakhic study itself as uniquely beloved and as the comprehension of God's own will and wisdom, framing established halakhah—rather than aggadic midrash—as the primary vehicle of closeness to the Torah's binding content, while Rav Kook (Ein Aya, Shabbat 6:67) continues in the same vein of drawing moral and psychological lessons from aggadic material without asserting it as a source of law.