Skip to content

Conversation

@markwahl-msft
Copy link
Contributor

In the Azure AD Identity.Governance module, this customization adds two parameter sets to New-MgEntitlementManagementAccessPackageAssignmentRequest, to simplify creating an Entitlement Management access package assignment request to administratively add or remove access.

For example, if an admin has the ID of an access package in $apid and the ID of a user in $tid, and the AP has a single policy for admin assignment, then to assign the user to that access package with that policy,

$ap = Get-MgEntitlementManagementAccessPackage -AccessPackageId $apid -ExpandProperty accesspackageassignmentpolicies
$polid = $ap.AccessPackageAssignmentPolicies[0].Id
New-MgEntitlementManagementAccessPackageAssignmentRequest -AccessPackageId $apid -AssignmentPolicyId $polid -TargetId $tid

@peombwa peombwa requested review from georgend and peombwa April 19, 2021 18:34
@peombwa peombwa self-requested a review May 7, 2021 00:46
@markwahl-msft markwahl-msft requested a review from ddyett as a code owner May 11, 2021 20:24
@markwahl-msft markwahl-msft requested a review from peombwa May 12, 2021 15:40
Copy link
Member

@peombwa peombwa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@adamedx
Copy link

adamedx commented May 13, 2021

Interesting -- so @markwahl-msft, @peombwa we could generalize this as a customization approach: if there is an existing command that is functionally correct in that it maps to a single API, we can create a PowerShell-based wrapper. One key question here: is this purely additive, or does it break the existing interface of the command?

@peombwa , is there any reason we can't add pipelining this way? I think this should be feasible.

@adamedx
Copy link

adamedx commented May 15, 2021

Also, @markwahl-msft do you plan on making this the default parameterset? And the docs must be provided via the comments of the PowerShell function?

@markwahl-msft
Copy link
Contributor Author

@adamedx Yes this is intended to be the default parameter set.

And the docs must be provided via the comments of the PowerShell function?

I had tried setting the synopsis and description in the top of the cmdlet ps1 file, but in get-help ... -detailed I'm not seeing the values set there. Ideally I'd like the help to be able to automatically incorporate content that's already been written in articles such as https://docs.microsoft.com/graph/api/accesspackageassignmentrequest-post for each of the cmdlets that corresponds to a single Graph API call, since those articles already have comprehensive descriptions, examples etc.

@peombwa
Copy link
Member

peombwa commented May 18, 2021

@adamedx This is purely additive and does not break existing parameterSets of the same command.

Is there any reason we can't add pipelining this way? I think this should be feasible.

We would have to apply a wrapper for all generated commands to support pipeline this way. AutoREST has its own piping mechanism which uses an InputObject. There is currently a bug with it where it assumes all id parameters are named Id and not {Entity}Id, like those in our OpenAPI files. e.g. Get-MgEntitlementManagementAccessPackage -Id vs Get-MgEntitlementManagementAccessPackage -AccessPackageId.

@peombwa peombwa merged commit e8143b6 into microsoftgraph:dev May 19, 2021
@markwahl-msft markwahl-msft deleted the mwahl-em-addl1 branch May 19, 2021 21:19
@peombwa peombwa mentioned this pull request Jun 2, 2021
@peombwa peombwa mentioned this pull request Jun 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants