Hello
Thank you for your question and reaching out.
Please use below code if it works for you , also please Disable MFA for this user.
#Variables
$PbiUser1 = "myUser@ mydomain.com"
$PbiPassword1 = "MyPassword"
#Create secure string for password
$PbiSecurePassword = ConvertTo-SecureString $PbiPassword -Force -AsPlainText
$PbiCredential = New-Object Management.Automation.PSCredential($PbiUser, $PbiSecurePassword)
#Connect to the Power BI service
Connect-PowerBIServiceAccount -Credential $PbiCredential
--If the reply is helpful, please Upvote and Accept as answer--