Error when attempting to increase prepaid units for subscribedSkus product using Graph API

Marius Iulian Cluci 20 Reputation points
2023-08-22T08:42:09.4633333+00:00

Hi,

I am attempting to increase the prepaid units for one of our licenses using the Graph API as part of an automation. However, I am receiving an error message:

{
    "error": {
        "code": "Request_BadRequest",
        "message": "Invalid value specified for property 'lockedOut' of resource 'LicenseUnitsDetail'.",
        "details": [
            {
                "code": "InvalidValue",
                "message": "Invalid value specified for property 'lockedOut' of resource 'LicenseUnitsDetail'.",
                "target": "lockedOut"
            }
        ],
        "innerError": {
            "date": "2023-08-22T08:10:10",
            "request-id": "0b08cf4c-86d2-4409-9b25-33c0281ccd44",
            "client-request-id": "5348d351-df7a-0e5f-19fd-805996cc36b3"
        }
    }
}

This is the request I am sending:

PATCH https://graph.microsoft.com/v1.0/subscribedSkus/*$id*

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#subscribedSkus(prepaidUnits)/$entity",
    "prepaidUnits": {
        "enabled": 16,
        "suspended": 0,
        "warning": 0,
        "lockedOut": 0
    }
}

I have also tried the same request using PowerShell, here is my code:

$body = "{
	`"prepaidUnits`": {
		`"enabled`": 16,
		`"lockedOut`": 0,
		`"suspended`": 0,
		`"warning`": 0
		}
	}"
$patch = Invoke-RestMethod -Uri $patchurl -Method Patch -Body $body -Headers $Header -ContentType $contentType

Can someone help me figure out what I am missing?

I have checked that the subscribedSku entity has the property "prepaidUnits" of type graph.licenseUnitsDetail which has this structure: https://learn.microsoft.com/en-us/graph/api/resources/licenseunitsdetail?view=graph-rest-1.0#json-representation

Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

Accepted answer
  1. Diah.Karim-MSFT 335 Reputation points Microsoft External Staff
    2024-01-02T02:11:24.68+00:00

    Hi Marius,

    As per documentation, i think for subscribedSkus MS Graph API endpoint it's only the read operation is supported; create, update, and delete aren't supported.

    You may refer to this article

    https://learn.microsoft.com/en-us/graph/api/subscribedsku-list?view=graph-rest-1.0&tabs=http

    As for now, only List and Get operations are part of the endpoints

    Hope this helps.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.