Azure / Azure/azure-rest-api-specs
graphrbac: API Bug: Key credential end date is invalid
- Dominant language
- TypeSpec
- Stars
- 3.1k
- Forks
- 5.9k
- Avg merge
- 3d 37m
- Merged PRs (30d)
- 446
Description
Resource: https://docs.microsoft.com/en-gb/previous-versions/azure/ad/graph/api/entity-and-complex-type-reference#keycredential-type
During testing of the Terraform AzureAD Provider, I'm encountering what seems to be a bug in date handling, possibly related to the impending year end. The issue occurs when creating a certificate (`KeyCredential`) for either an application or a service principal. Any specified `endDate` after 2021-05-31 returns the following:
### Request
```http
PATCH /26e25406-6564-4a26-98ee-c71ba03235ad/servicePrincipals/907c31ab-373e-4926-8fe8-b3f63025c8e8/keyCredentials?api-version=1.6 HTTP/1.1
{
"value": [{
"endDate": "2021-06-01T13:23:30Z",
"keyId": "909484b5-9f16-5f68-b558-f8e0cee0e5e5",
"type": "AsymmetricX509Cert",
"usage": "verify",
"value": "my key data"
}]
}
```
### Response
```http
HTTP/1.1 400 Bad Request
{
"odata.error": {
"code": "Request_BadRequest",
"message": {
"lang": "en",
"value": "Key credential end date is invalid."
},
"requestId": "f7fd4ac2-6499-4e8d-acd7-3765d5a5bcde",
"date": "2020-12-07T14:24:01"
}
}
```
Turning the `endDate` back one day to 2021-05-31 receives a 204 response as expected.
Until recently (possibly the start of December 2020) it was possible to set an endDate more than 5 months in the future.
Contributor guide
Research direction
Start with the linked KeyCredential API reference and reproduce the PATCH request against the servicePrincipals keyCredentials endpoint using endDate values around 2021-05-31 and 2021-06-01. Compare the observed behavior with the documented contract and identify whether the REST specification needs correction. Done means the date behavior is confirmed and the appropriate API specification change or external-service clarification is recorded.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100