Skip to content

New-MgEntitlementManagementAccessPackageAssignmentRequest | "The property 'TargetId' cannot be found on this object"  #1618

@omarlucia

Description

@omarlucia

I'm trying to add assignments for an access package in Azure AD entitlement management. For that I'm following this docuemntation, assign-a-user-to-an-access-package-with-powershell

For that I'm using same snippet described just replacing it with my own values. (access package and user id)

Connect-MgGraph -Scopes "EntitlementManagement.ReadWrite.All"
Select-MgProfile -Name "beta"
$accesspackage = Get-MgEntitlementManagementAccessPackage -DisplayNameEq "My access package name" -ExpandProperty "accessPackageAssignmentPolicies"
$policy = $accesspackage.AccessPackageAssignmentPolicies[0]
$req = New-MgEntitlementManagementAccessPackageAssignmentRequest -AccessPackageId $accesspackage.Id -AssignmentPolicyId $policy.Id -TargetId "a43ee6df-3cc5-xxxx-xxxx-ea964ef8e464"

Issue

When i run this i get the next error:

New-MgEntitlementManagementAccessPackageAssignmentRequest : The property 'TargetId' cannot be found on this object.
Verify that the property exists and can be set.

This error dont let me to add user to the access package.

As I see in documentation, 'TargetId" must be not empty with combination 'AccessPackageId' and 'AssignmentPolicyId' parameters.

versions

I currently download ps Microsoft.Graph 1.15.0 (also trying with 1.13.0 version)
Install-Module -Name Microsoft.Graph -Scope CurrentUser

Version              Name                                Repository           Description
-------              ----                                ----------           -----------
1.15.0               Microsoft.Graph                     PSGallery            Microsoft Graph PowerShell module
1.15.0               Microsoft.Graph.Applications        PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.Authentication      PSGallery            Microsoft Graph PowerShell Authentication Module.
1.15.0               Microsoft.Graph.Bookings            PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.Calendar            PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.ChangeNotifications PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.CloudCommunications PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.Compliance          PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.CrossDeviceExperie… PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.DeviceManagement    PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.DeviceManagement.A… PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.DeviceManagement.A… PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.DeviceManagement.E… PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.DeviceManagement.F… PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.Devices.CloudPrint  PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.Devices.CorporateM… PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.Devices.ServiceAnn… PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.DirectoryObjects    PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.Education           PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.Files               PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.Financials          PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.Groups              PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.Identity.Directory… PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.Identity.Governance PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.Identity.SignIns    PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.Mail                PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.ManagedTenants      PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.Notes               PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.People              PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.PersonalContacts    PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.Planner             PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.Reports             PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.SchemaExtensions    PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.Search              PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.Security            PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.Sites               PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.Teams               PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.Users               PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.Users.Actions       PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.Users.Functions     PSGallery            Microsoft Graph PowerShell Cmdlets
1.15.0               Microsoft.Graph.WindowsUpdates      PSGallery            Microsoft Graph PowerShell Cmdlets

PowerShell version

PS C:\Users\EIPEA\test> $PSVersionTable.PSVersion

Major  Minor  Patch  PreReleaseLabel BuildLabel
-----  -----  -----  --------------- ----------
7      3      0

Can somebody help me in figureout why error New-MgEntitlementManagementAccessPackageAssignmentRequest: The property 'TargetId' cannot be found on this object. Verify that the property exists and can be set. is showing?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions