Skip to content

[BUG] Invalid request format when updating application certificate credentials #48338

@jcarnus

Description

@jcarnus

Describe the bug
When using the Azure SDK to update an Azure Directory Applications, the SDK seems to not encode correctly the certificate given as parameter with withPublicKey() retrieve from X509Certificate.getEncoded(). Submitting as a PEM directly is also not possible because the SDK does internally convert to Base64.

Exception or Stack Trace
"{"error":{"code":"Request_BadRequest","message":"Cannot convert the literal 'XXX' to the expected type 'Edm.Binary'.","innerError":{"date":"2026-03-02T20:44:14","request-id":"XXX","client-request-id":"XXX"}}}"

Code Snippet
var application = azureResourceManager.accessManagement() .activeDirectoryApplications() .getByName(applicationId);

X509Certificate x509Cert = read from somewhere

update.defineCertificateCredential(certificateName) .withAsymmetricX509Certificate() .withPublicKey(x509Cert.getEncoded()) .withStartDate(startDate) .withDuration(java.time.Duration.ofDays(durationInMonths * 30L)) .attach();

Metadata

Metadata

Assignees

No one assigned

    Labels

    customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-triageWorkflow: This is a new issue that needs to be triaged to the appropriate team.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