microsoftgraph / microsoftgraph/msgraph-beta-sdk-dotnet
Unable to create a TrustFrameworkKeySet and TrustFrameworkKey at the same time
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 112
- Forks
- 37
- Avg merge
- 14h 57m
- Merged PRs (30d)
- 3
Description
Describe the bug
I am trying to create a TrustFrameworkKeySet and TrustFrameworkKey at the same time using Microsoft.Identity.Web.GraphServiceClientBeta version 3.0.1 which is using Microsoft.Graph.Beta 5.78.0-preview. I get the following error:
The 'keySet' field is invalid in request. Please check the request body and parameters.
Expected behavior
To create a TrustFrameworkKey while creating a TrustFrameworkKeySet using the follow guide trustframework-post-keysets.
How to reproduce
Where:
secret - the key to add
name - name of the key to create
graphServiceClient - Microsoft.Graph.Beta.GraphServiceClient
TrustFrameworkKeySetCollectionResponse? keySets = await graphServiceClient.TrustFramework.KeySets.GetAsync(cancellationToken: cancellationToken);
TrustFrameworkKeySet? trustFrameworkKeySet = keySets?.Value?.FirstOrDefault(x => x.Id == name);
if (trustFrameworkKeySet == null)
{
trustFrameworkKeySet = new()
{
Id = name,
Keys =
[
new TrustFrameworkKey()
{
Use = "sig",
K = secret,
Kty = "oct"
}
]
};
trustFrameworkKeySet = await graphServiceClient.TrustFramework.KeySets.PostAsync(trustFrameworkKeySet, cancellationToken: cancellationToken);
}
SDK Version
5.78.0-preview
Latest version known to work for scenario above?
No response
Known Workarounds
I am able to create the TrustFrameworkKeySet then Upload a secret separately but it always creates a .bak key.
Debug output
Click to expand log
```</details>
### Configuration
_No response_
### Other information
_No response_
Contributor guide
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 TrustFramework.KeySets.PostAsync call and compare its TrustFrameworkKeySet payload with the linked trustframework-post-keysets example for Microsoft.Graph.Beta 5.78.0-preview. Investigate why the keySet field is rejected when a key is included during creation, then verify that creating the set with the requested key succeeds without producing an unexpected .bak key.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100