question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Method importCertificate in azure-security-keyvault-certificates:4.0.0 fails with 405

See original GitHub issue

Hi,

I’m trying to upload pre-existing certificates to our key vault. I’ve successfully used the certificate creation flow, so I know I can communicate with the key vault. This seems like an underlying issue.

I have generated a certificate and saved it in a file called root.pem. It’s formatted as follows to satisfy the requirements of ImportCertificateOptions:

-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----

I call the import method as follows:

// SDK call
client.importCertificate(new ImportCertificateOptions("import", Objects.requireNonNull(Util.fileToByteArray("keys/root.pem"))));

// Util method
public static byte[] fileToByteArray(final String path) {
    try {
        return Files.readAllBytes(Path.of(path));
    } catch (IOException e) {
        e.printStackTrace();
    }
    return null;
}

When I call this method, the call fails with:

com.azure.core.exception.HttpResponseException: Status code 405, “{“error”:{“code”:“MethodNotAllowed”,“message”:“HTTP POST not allowed”}}”

The call fails in the SDK class CertificateService.

Information

SDK(s): com.azure:azure-security-keyvault-certificates:4.0.0 com.azure:azure-identity:1.0.3

JDK: openjdk 11.0.5 2019-10-15 OpenJDK Runtime Environment (build 11.0.5+10-post-Ubuntu-0ubuntu1.1) OpenJDK 64-Bit Server VM (build 11.0.5+10-post-Ubuntu-0ubuntu1.1, mixed mode, sharing)

OS: No LSB modules are available. Distributor ID: Ubuntu Description: Pop!_OS 19.10 Release: 19.10 Codename: eoan

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jokarlcommented, Jul 25, 2020

Thanks @vcolin7, I’m on vacation right now but I’ll see if I can get this to work once I’m back. I do think I have a working upload with a certificate generated using Java and bouncy castle. But this was a while ago so I have to refresh my memory and look at the code base to be sure.

0reactions
msftbot[bot]commented, Aug 14, 2020

Hi, we’re sending this friendly reminder because we haven’t heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don’t hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Application Gateway causing login to fail with a 405 error
When running a 3rd party application through an App Gateway, I get a 405 error when trying to log in. This does not...
Read more >
405 Method Not Allowed - HTTP - MDN Web Docs
The HyperText Transfer Protocol (HTTP) 405 Method Not Allowed response status code indicates that the server knows the request method, ...
Read more >
FastAPI gives error 405 method not allowed while running the ...
I am working on Fast API project based on Angular UI. Before wheel package converted it is been working fine. So now when...
Read more >
API Call results in "Method Not Allowed" or 405 error
Overview. When making a request to the Okta API one of the following errors is returned (depending on the API client being used):....
Read more >
HTTP Error “405 Method Not Allowed”: How to solve the problem
The message “405 Method Not Allowed” indicates that the client is using an unauthorized HTTP method. Here's how to fix the error code....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found