question

PallaviChede-6157 avatar image
0 Votes"
PallaviChede-6157 asked JamesTran-MSFT commented

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

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://docs.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-active-directoryazure-logic-appsazure-ad-app-registrationazure-ad-app-development
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @PallaviChede-6157 thanks for reaching out. Would you kindly share the request-id and date so we can look into this?

0 Votes 0 ·

@PallaviChede-6157
Thank you for your post and I apologize for the delayed response!

Are you able to share the full error message you're receiving, or any screenshots so we can gain a better understanding of your issue?


If you have any other questions, please let me know.
Thank you for your time and patience throughout this issue.

0 Votes 0 ·

Hello @JamesTran-MSFT

I have attached my Logic app action as well as error screen shot PFA .

132367-logicapperror.png

Below is Logic app action


132773-logicappaction.png
Complete error message is - Specified HTTP method is not allowed for the request target.

Please find below screen shot of complete logic app
132821-image.png

Action 1- get event for certification created
Action 2- Parse Action Received certificate to Json
Action 3- Get certificate from URL get from previous action
Action 4- Parse Certificate into JSon
Action 5- Try To Update existing service principle with certificate received Action 4(but getting Method not allowed error )
You can find complete request of Action 5 on logicappaction.png


0 Votes 0 ·
logicapperror.png (22.3 KiB)
logicappaction.png (21.1 KiB)
image.png (26.2 KiB)

1 Answer

JamesTran-MSFT avatar image
0 Votes"
JamesTran-MSFT answered PallaviChede-6157 commented

@PallaviChede-6157
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.

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @JamesTran-MSFT


I have attached my response to your questions and what problem I am facing into attached PDF.

Issue still there so can we connect to discuss it with support engineer .

0 Votes 0 ·

@PallaviChede-6157
Thank you for the quick follow up on this! I'll send you a private comment shortly to discuss next steps for working with our support engineers on this issue.

0 Votes 0 ·