See Rashi P' Beshalach 14:4:
ואכבדה בפרעה. כְּשֶׁהַקָּבָּ"ה מִתְנַקֵּם בָּרְשָׁעִים שְׁמוֹ
מִתְגַּדֵּל וּמִתְכַּבֵּד, וְכֵן הוּא אוֹמֵר "וְנִשְׁפַּטְתִּי אִתּוֹ
וְגוֹ'" וְאַחַר כָּךְ "וְהִתְגַדִּלְתִּי וְהִתְקַדִּשְׁתִּי
וְנוֹדַעְתִּי וְגוֹ'" (יחזקאל ל"ח), וְאוֹמֵר "שָׁמָּה שִׁבַּר רִשְׁפֵי
קָשֶׁת", וְאַחַר כָּךְ "נוֹדָע בִּיהוּדָה אֱלֹהִים" (תהלים ע"ו),
וְאוֹמֵר "נוֹדַע ה' מִשְׁפָּט עָשָׂה" (שם ט'):
ואכבדה בפרעה AND I WILL BE HONOURED THROUGH PHARAOH — When the Holy
One, blessed be He, takes vengeance on the wicked His name is
magnified and honoured. Thus, too, it states, (Ezekiel 38:22, 23) “And
I will plead against him [with pestilence and with blood etc.]”, and
afterwards, “Thus I shall be magnified and sanctified etc.” And it
states, (Psalms 76:3) “There He broke the fiery shafts of the bow”,
and afterwards (after He has done this) (v. 2) “In Judah is God known.
“Further it states, (Psalms 9:17) “The Lord is known because He
executeth judgment” (Mekhilta d'Rabbi Yishmael 14:4:2).
Since when Hashem takes vengeance on the wicked His name is magnified and honored, This also appeases the anger of Hashem, which came about through the chilul Hashem caused by the sinners.