Skip to content

Az Login --Service-Principal Broken Auth #30456

@WilliamDShiell

Description

@WilliamDShiell

Describe the bug

Attempting to Authenticate into Azure from CLI using the following command:
az login --service-principal --username "INSERT APP ID" --password "INSERT SECRET" --tenant "INSERT TENANT ID"

Receiving the following error message back:
powershell.exe : ERROR: AADSTS700016: Application with identifier 'INSERT APP ID' was not found in the directory 'Microsoft Services'. This can happen if the
application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You may have sent your authentication request to the wrong tenant.

Can confirm App Id, Tenant Id and Secret are correct as attempting Authentication with the equivalent PowerShell Command works as expected

Related command

az login --service-principal --username "INSERT APP ID" --password "INSERT SECRET" --tenant "INSERT TENANT ID"

Errors

powershell.exe : ERROR: AADSTS700016: Application with identifier 'INSERT APP ID' was not found in the directory 'Microsoft Services'. This can happen if the
application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You may have sent your authentication request to the wrong tenant.

Issue script & Debug output

powershell.exe : ERROR: AADSTS700016: Application with identifier 'INSERT APP ID' was not found in the directory 'Microsoft Services'. This can happen if the
application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You may have sent your authentication request to the wrong tenant.

Expected behavior

Authenticate to Azure as expected.

Environment Summary

azure-cli 2.56.0 *

core 2.56.0 *
telemetry 1.1.0

Extensions:
logicapp 0.1.2

Dependencies:
msal 1.24.0b2
azure-mgmt-resource 23.1.0b2

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\wshiell.azure\cliextensions'

Python (Windows) 3.11.5 (tags/v3.11.5:cce6ba9, Aug 24 2023, 14:38:34) [MSC v.1936 64 bit (AMD64)]

Legal docs and information: aka.ms/AzureCliLegal

Additional context

Attempted Troubleshooting:

  1. Attempt to Connect using Connect-AzAccount with same values, works as expected.
  2. Attempt to connect with Azure Cloud Shell Bash, also fails.

Metadata

Metadata

Assignees

Labels

Accountaz login/accountAuto-AssignAuto assign by botAuto-ResolveAuto resolve by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamSimilar-Issuecustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions