Product: PowerShell Universal
Version: 5.5.1
Hey PSU folks,
I’m having an issue connecting to Azure, using the Az module, from within automated job scripts. When I run the below directly in VSCode it connects without issue. However, when I have this inside a job script, it fails with
Entry point was not found. Could not find tenant id for provided tenant domain ‘x-x-x-x-x’. Please ensure that the provided service principal ‘x-x-x-x-x’ is found in the provided tenant domain.
$plainTextPassword = "<Service Principal Secret>"
$securePassword = ConvertTo-SecureString $plainTextPassword -AsPlainText -Force
$username = "<Service Principal Client Id>"
$creds_Azure = New-Object System.Management.Automation.PSCredential ($username, $securePassword)
$tenantId = '<Tenant Id>'
Connect-AzAccount -TenantId $tenantId -Credential $creds_Azure -ServicePrincipal -ErrorAction Stop
In 2023 I updated PSU to the then latest version, and I had this same issue in Can no longer connect to Azure with Connect-AzAccount - PowerShell Universal / Universal Dashboard - Ironman Software Forums
At that time, I was able to roll back to the previous version of PSU, but 5.5.1 is the first version installed in this environment, so no previously working version to roll back to.
I did update to the latest version of 5.5.5, hoping it would fix things, but I still have the same problem. I also tried updating the Az module from 13.4.0 to the latest 14.2.0, but no go.
Found I also had this more recently in Connect-AzAccount no longer working after 5.2.0 upgrade - PowerShell Universal - Ironman Software Forums where the solution was an update to PSU.
Any ideas?
Thanks,
Rob