Skip to content

Az login with service principal does not work using SNI cert, not sending certificate chain #29386

@grgarcia-ms

Description

@grgarcia-ms

Describe the bug

When downloading cert from kv as in instructions here, login in DOES NOT WORK if cert relies on signed cert. It DOES work on SDK packages, with same cert, somewhere in az cli the certificate CHAIN seems like is not being sent like sdk (send_certificate_chain=True)
https://learn.microsoft.com/en-us/cli/azure/azure-cli-sp-tutorial-3#work-with-azure-key-vault

Related command

az login --service-principal -u "" -p cert.pem --tenant ""

Errors

AADSTS700030: Invalid certificate - subject name in certificate is not authorized. SubjectNames/SubjectAlternativeNames (up to 10) in token certificate are: ameroot. Trace ID: 3a06737e-f940-45f3-96a2-0cd091da5100 Correlation ID: a957054b-bbc5-403b-ac43-fa5fb4ae041e Timestamp: 2024-07-15 16:48:58Z

Issue script & Debug output

az keyvault secret download --file /path/to/cert.pfx
--vault-name VaultName
--name CertName
--encoding base64
openssl pkcs12 -in cert.pfx -passin pass: -passout pass: -out cert.pem -nodes
az login --service-principal -u "" -p cert.pem --tenant ""

Expected behavior

login should work

Environment Summary

azure-cli 2.39.0 *

core 2.39.0 *
telemetry 1.0.6 *

Extensions:
ml 0.0.125556467
providerhub 0.2.0

Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.1.0b1

Additional context

this is very urgent as teams move to use cert instead of passwords, please prioritize if possible

Metadata

Metadata

Labels

Accountaz login/accountAuto-AssignAuto assign by botAuto-ResolveAuto resolve by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamKeyVaultaz keyvaultOKR CandidateThis label is used to track how many GitHub issues we have resolved for OKR purpose.needs-author-feedbackMore information is needed from author to address the issue.no-recent-activityThere has been no recent activity on this issue.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

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions