Mg Beta: Entitlement Management -Answers Switch Fix

A quick post for those who are are trying to use the CMDlet New-MgBetaEntitlementManagementAccessPackageAssignmentRequest.

If you have wondered how the anwsers input values should look like this should help. It is Beta but might help until the doco is updated. - See more below.

Joshua Bines

https://learn.microsoft.com/en-us/powershell/module/microsoft.graph.beta.identity.governance/new-mgbetaentitlementmanagementaccesspackageassignmentrequest?view=graph-powershell-beta


$answers = @(
        @{
            "@odata.type" = "#microsoft.graph.accessPackageAnswerString"
            value = "The answer to the question"
            answeredQuestion = @{
                "@odata.type" = "#microsoft.graph.accessPackageTextInputQuestion"
                id = "$questionId"
            }
        }
    )

New-MgBetaEntitlementManagementAccessPackageAssignmentRequest -RequestType 'AdminAdd' -AccessPackageId $accessPackageId -AssignmentPolicyId $accesPackagePolicyId -TargetEmail $userEmail -Answers $answers