Hi,
I have 6 subscriptions access (different user accounts) in separate tenants. I would like to get resources details from all subscriptions using PowerShell script.
And I am using below script to authenticate a user and to get access to Azure subscription. The script is working fine for few subscriptions.
-------------------------------
$useraccount= 'xxxxxxxxxxxxxxxxxxxxxxxxxxx'
$password = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
$AzureSubscriptionID = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
$SecurePassword = ConvertTo-SecureString -AsPlainText $password -Force
$Cred = New-Object System.Management.Automation.PSCredential -ArgumentList $useraccount, $SecurePassword
(Login-AzureRmAccount -Credential $Cred -SubscriptionId $AzureSubscriptionID -ErrorAction Stop) | Out-Null
-------------------------------
And below is the error message for few accounts.
--------------------------------
Login-AzureRmAccount : AADSTS70002: Error validating credentials. AADSTS50126: Invalid username or password
Trace ID: 485faec7-6089-402a-b63a-a608f0584900
Correlation ID: dad46558-700f-4eb4-90cb-f81480c7e7de
Timestamp: 2018-10-16 10:31:02Z: The remote server returned an error: (400) Bad Request.
---------------------------------
Here I am passing the valid Username and password and able to get an access when I use the single command "Login-AzureRmAccount".
But getting the error when trying with the script.
Can someone help me here