microsoftgraph / microsoftgraph/msgraph-metadata
`synchronization/secrets` Cannot remove secret when json is value
Nobody has claimed this yet.
- Dominant language
- XSLT
- Stars
- 166
- Forks
- 55
- Avg merge
- 16h 12m
- Merged PRs (30d)
- 14
Description
Hello! Not sure if this is the best place to report this, but thought I'd give it a shot.
We have noticed an issue with the https://graph.microsoft.com/beta/servicePrincipals/${serviceprincipal}/synchronization/secrets api endpoint.
It only supports GET and PUT, so if you want to remove secrets, you have to perform a PUT with the value of the secret as "".
However, this only works if the original value of the secret was a plain string value.
If the value was a complex type, such as a JSON blob (as in the example here: https://learn.microsoft.com/en-us/graph/api/synchronization-synchronization-secrets?view=graph-rest-beta&tabs=http#request), there does not appear to be a way to remove the secret because if you set the value to an empty "" string, you get the following error:
Bad Request({"error":{"code":"UnknownError","message":"{\r\n \"error\":{\r\n \"code\":\"InvalidNotificationSettings\",\"message\":null,\"target\":null,\"details\":[\r\n \r\n ],\"innerError\":null\r\n }\r\n}","innerError":{"date":"2023-01-11T16:57:55","request-id":"8927006e-edb2-435b-a966-49559c4fd064","client-request-id":"8927006e-edb2-435b-a966-49559c4fd064"}}})
We also tried setting the value to "{}", which worked, but leaves the secret in place like below:
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#servicePrincipals('123456-12312312-123123-')/synchronization/secrets",
"value": [
{
"key": "SyncNotificationSettings",
"value": "{}"
}
]
}
Is this an API bug?
Originally posted by @tagur87 in https://github.com/microsoftgraph/msgraph-metadata/issues/127#issuecomment-1379210820
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Microsoft Graph synchronization/secrets endpoint and the linked synchronization-secrets documentation example. Reproduce the PUT behavior for a plain-string secret versus the JSON value, including the empty-string and "{}" cases. Done means establishing whether the API supports deletion for complex values and identifying the appropriate documented or API-level resolution.
Written by the indexing model from the issue text.
Assessment
- Domain
- api
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 20/100