The solution is very simple.
First, log in to your Azure portal.
Then create a new user within current Entra ID, which will be a subordinate user of your tenant.
Assign the Global Administrator role to this new user.
Next, log out of your Azure portal and log back in with the new user you created, which has been given the Global Administrator role.
Again, attempt to upgrade from Entra ID Free to Entra ID P2 using this method. You will be asked a series of questions about your credit card information, and finally, your account will be upgraded.
Good Luck
Masoud