Share via

Not able to update certificate in existing service principle through logic app or graph API

Pallavi Chede 1 Reputation point
2021-09-09T18:39:15.79+00:00

I am trying to take certificate from azure key Vault & want to upload it against service principle but I am getting method not allowed error.

Graph API call- PATCH

https://graph.microsoft.com/v1.0/applications?$filter=appId eq 'XXXXXXXXX'

Steps Followed from below article for request body

https://learn.microsoft.com/en-us/graph/api/resources/keycredential?view=graph-rest-1.0

I converted Certificate into Json (property name given in bracket below)
{
"@odata.type": //Given error so removed ,
"customKeyIdentifier": //Key vault's Certificate Identifier (kid),
"displayName": //Removed,
"endDateTime": //Key Vault's Certificate Expiration date (exp),
"key": "Binary" ://Key Vault's Certificate certicate (Cer) ,
"keyId": //New GUID,
"startDateTime": //Certificate Created date (Created ),
"type": "AsymmetricX509Cert",
"usage": "Verify"
}

Azure Logic Apps
Azure Logic Apps

An Azure service that automates the access and use of data across clouds without writing code.

Microsoft Security | Microsoft Entra | Microsoft Entra ID
{count} votes

1 answer

Sort by: Most helpful
  1. JamesTran-MSFT 37,236 Reputation points Microsoft Employee Moderator
    2021-09-16T21:06:59.113+00:00

    @Pallavi Chede
    Thank you for the quick follow up!

    Based off your error message - 405 Method Not Allowed, it looks like you're using a PATCH request when you should be using a POST per the application: addKey documentation. I also found that Key management operations use HTTP DELETE, GET, PATCH, PUT and HTTP POST and cryptographic operations against existing key objects use HTTP POST. For more info.

    Additional Links:
    Request Body
    Using HTTP POST
    405 Method Not Allowed: What It Is and How to Fix It

    If you're still having problems:

    • Was your Logic App working previously? Or did this issue just start?
    • If this is a new issue, do you know what could've changed to have caused this error?

    If you have any other questions or would like our support engineers to take a closer look into your environment, please let me know.
    Thank you for your time and patience throughout this issue.

    ----------

    Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.