Azure Identity
4 TopicsAccess Package Policy via script
Think I'm going crazy wondering if anyone can help. I'm attempting to create a policy for an existing Access Package and set the duration time to 12 hours The intention is these packages will work a lot like a PIM group but they are for certain testing profiles Script looks like $allowedRequestors = @(@{ "@odata.type" = '#microsoft.graph.groupMembers' "id"= 'GroupIDRedacted' "description" = 'GroupNameRedacted' }) $params = @{ displayName = "12 Hour Tester Policy" description = "Provide access for 12 hours" allowedTargetScope = "notSpecified" expiration = @{ duration = 'PT12H' type = 'afterDuration' } requestorSettings = @{ "scopeType" = 'SpecificDirectorySubjects' "acceptRequests" = $true "allowedRequestors" = $allowedRequestors } requestApprovalSettings = @{ "isApprovalRequired" = $false "isApprovalRequiredForExtension" =$false "isRequestorJustificationRequired"= $false "approvalMode"= 'NoApproval' "approvalStages"= '[]' } accessPackage = @{ id = $ap.id } } This is to set the parameters I then run the command of New-MgBetaEntitlementManagementAccessPackageAssignmentPolicy -BodyParameter $params -verbose And it will create the policy but the lifecycle expiration is still set to never while all other settings have worked. If I try the non beta command It prompts me for an AccessPackageID as tho none is in the parameters so I supply the same id of the access package as in $ap.id I get the error: "New-MgEntitlementManagementAccessPackageAssignmentPolicy_Create: The request URI is not valid. Since the segment 'accessPackages' refers to a collection, this must be the last segment in the request URI or it must be followed by an function or action that can be bound to it otherwise all intermediate segments must refer to a single resource." Has anyone successfully created an azure access package policy via PowerShell with a duration lifecycle? care to post and example of your parameters if so?1.1KViews1like2Comments