Login-AzureRmAccount -Credential $cred -TenantId "Tenant ID" command is failing with error AADSTS50034: The user account Microsoft.AzureAD.Telemetry.Diagnostics.PII does not exist.

AmandaCH 41 Reputation points
2019-12-14T10:48:08.95+00:00

I am following the steps mentioned in following article:
https://social.technet.microsoft.com/wiki/contents/articles/40062.azure-automating-login-for-powershell-scripts-using-service-principal.aspx

The Login-AzureRmAccount -Credential $cred -TenantId "Tenant ID" command is failing with error AADSTS50034: The user account Microsoft.AzureAD.Telemetry.Diagnostics.PII does not exist.

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,456 questions
0 comments No comments
{count} votes

Accepted answer
  1. AmanpreetSingh-MSFT 56,306 Reputation points
    2019-12-16T04:35:17.88+00:00

    @AmandaCH In this case, you are using $cred for application credentials. However, Azure AD is looking for a user account with those credentials. You need to add -ServicePrincipal switch to the command to instruct Azure AD to look for application rather than user account. Below is how the command should look:

    Login-AzureRmAccount -ServicePrincipal -Credential $cred -TenantId "Tenant ID"

    -----------------------------------------------------------------------------------------------------------

    Please "mark as answer" or "vote as helpful" wherever the information provided helps you to help others in the community.

    0 comments No comments

0 additional answers

Sort by: Most helpful