[Bug] EntitlementAccessRequestConfig - Multiple issues
First, this would be what's considered a valid request body to hit the PUT /beta/entitlements/:id/entitlement-request-config endpoint
{
"accessRequestConfig": {
"requestCommentRequired": false,
"denialCommentRequired": false,
"reauthorizationRequired": false,
"approvalSchemes": [
{
"approverId": "7a1eedb9-8882-4789-918f-aae88c4a4eb2",
"approverType": "GOVERNANCE_GROUP"
}
]
},
"revocationRequestConfig": {
"approvalSchemes": []
}
}
Per the reference docs, it says as much
$EntitlementRequestConfig = @"{
"accessRequestConfig" : {
"denialCommentRequired" : false,
"approvalSchemes" : [ {
"approverId" : "e3eab852-8315-467f-9de7-70eda97f63c8",
"approverType" : "GOVERNANCE_GROUP"
}, {
"approverId" : "e3eab852-8315-467f-9de7-70eda97f63c8",
"approverType" : "GOVERNANCE_GROUP"
} ],
"reauthorizationRequired" : false,
"requestCommentRequired" : true
},
"revocationRequestConfig" : {
"approvalSchemes" : [ {
"approverId" : "e3eab852-8315-467f-9de7-70eda97f63c8",
"approverType" : "GOVERNANCE_GROUP"
}, {
"approverId" : "e3eab852-8315-467f-9de7-70eda97f63c8",
"approverType" : "GOVERNANCE_GROUP"
} ]
}
}"@
The reference doc also says you need to call ConvertFrom-JsonToEntitlementRequestConfig, however, that is building a request body for the PUT /access-request-config endpoint
What the documentation should actually be asking for is to call ConvertFrom-BetaJsonToEntitlementAccessRequestConfig . This is problematic as well because it expects you to give it the value of the property accessRequestConfig like this
{
"requestCommentRequired": false,
"denialCommentRequired": false,
"reauthorizationRequired": false,
"approvalSchemes": [
{
"approverId": "7a1eedb9-8882-4789-918f-aae88c4a4eb2",
"approverType": "GOVERNANCE_GROUP"
}
]
}
When it actually sends the request via Send-BetaEntitlementRequestConfig, it's only sending that accessRequestConfig instead of the whole thing (like the JSON at the top) and you get a 400 as a result
{
"messages": [
{
"localeOrigin": "DEFAULT",
"locale": "en-US",
"text": "Required field \"accessRequestConfig\" was missing or empty."
},
{
"localeOrigin": "REQUEST",
"locale": "en-US",
"text": "Required field \"accessRequestConfig\" was missing or empty."
}
],
"trackingId": "7d6e77b4767a47c1939a9398ed10401e",
"detailCode": "400.1.0 Required data missing or empty"
}
Hey Mark,
I think I've got this figured out. We should be adding the api prefix to all the ConvertFrom helper cmdlets which it seems to be missing from our documentation examples. Would you agree that ConvertFrom-BetaJsonToEntitlementRequestConfig would give the correct request body structure?
I am getting a PR to correct the documentation ready now.
ok, it's working now
When ConvertFrom-JsonToEntitlementRequestConfig didn't work, I assumed that ConvertFrom-BetaJsonToEntitlementRequestConfig would have the same problem and thought it was meant to create a PSObject for the same API endpoint. That was incorrect.
As it turns out, the beta equivalent of ConvertFrom-JsonToEntitlementRequestConfig is ConvertFrom-BetaJsonToEntitlementRequestConfig1
ConvertFrom-BetaJsonToEntitlementRequestConfig creates the correct PSObject