Read 2 Chronicles 12 today.

2 Chronicles 12:1-2, 6-8 NLT[1] But when Rehoboam was firmly established and strong, he abandoned the Law of the LORD, and all Israel followed him in this sin. [2] Because they were unfaithful to the LORD, King Shishak of Egypt came up and attacked Jerusalem in the fifth year of King Rehoboam’s reign. [6] Then the leaders of Israel and the king humbled themselves and said, “The LORD is right in doing this to us!” [7] When the LORD saw their change of heart, he gave this message to Shemaiah: “Since the people have humbled themselves, I will not completely destroy them and will soon give them some relief. I will not use Shishak to pour out my anger on Jerusalem. [8] But they will become his subjects, so they will know the difference between serving me and serving earthly rulers.”
Rehoboam was the king over the southern tribes, but he abandoned the Lord and led the people to abandon the Lord also. There would be consequences to that choice. The Egyptians attacked and made the people subject to King Shishak of Egypt. Verse 8 is telling as it reminds us that God allowed the people to experience the consequences of their choices.
Regardless of the master to whom we subject ourselves, there will be consequences. It is a package deal. The master and the consequences go together.
Joshua 24:14-15 NLT
[14] “So fear the LORD and serve him wholeheartedly. Put away forever the idols your ancestors worshiped when they lived beyond the Euphrates River and in Egypt. Serve the LORD alone. [15] But if you refuse to serve the LORD, then choose today whom you will serve. Would you prefer the gods your ancestors served beyond the Euphrates? Or will it be the gods of the Amorites in whose land you now live? But as for me and my family, we will serve the LORD.”