Skip to content

Commit 5281d18

Browse files
authored
Merge pull request #188257 from markwahl-msft/mwahl-em-resapp
add PSh for adding a resource to a catalog in beta
2 parents 14323b1 + d8673cd commit 5281d18

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

articles/active-directory/governance/entitlement-management-catalog-create.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,25 @@ To require attributes for access requests:
165165

166166
### Add a resource to a catalog programmatically
167167

168-
You can also add a resource to a catalog by using Microsoft Graph. A user in an appropriate role, or a catalog and resource owner, with an application that has the delegated `EntitlementManagement.ReadWrite.All` permission can call the API to [create an accessPackageResourceRequest](/graph/api/entitlementmanagement-post-accesspackageresourcerequests?view=graph-rest-beta&preserve-view=true). An application with application permissions can't yet programmatically add a resource without a user context at the time of the request, however.
168+
You can also add a resource to a catalog by using Microsoft Graph. A user in an appropriate role, or a catalog and resource owner, with an application that has the delegated `EntitlementManagement.ReadWrite.All` permission can call the API to [create an accessPackageResourceRequest](/graph/api/entitlementmanagement-post-accesspackageresourcerequests?view=graph-rest-beta&preserve-view=true). An application with the application permission `EntitlementManagement.ReadWrite.All` and permissions to change resources, such as `Group.ReadWrite.All`, can also add resources to the catalog.
169+
170+
### Add a resource to a catalog with PowerShell
171+
172+
You can also add a resource to a catalog in PowerShell with the `New-MgEntitlementManagementAccessPackageResourceRequest` cmdlet from the [Microsoft Graph PowerShell cmdlets for Identity Governance](https://www.powershellgallery.com/packages/Microsoft.Graph.Identity.Governance/) module version 1.6.0 or later. The following example shows how to add a group to a catalog as a resource.
173+
174+
```powershell
175+
Connect-MgGraph -Scopes "EntitlementManagement.ReadWrite.All,Group.ReadWrite.All"
176+
Select-MgProfile -Name "beta"
177+
$g = Get-MgGroup -Filter "displayName eq 'Marketing'"
178+
Import-Module Microsoft.Graph.Identity.Governance
179+
$catalog = Get-MgEntitlementManagementAccessPackageCatalog -Filter "displayName eq 'Marketing'"
180+
$nr = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphAccessPackageResource
181+
$nr.OriginId = $g.Id
182+
$nr.OriginSystem = "AadGroup"
183+
$rr = New-MgEntitlementManagementAccessPackageResourceRequest -CatalogId $catalog.Id -AccessPackageResource $nr
184+
$ar = Get-MgEntitlementManagementAccessPackageCatalog -AccessPackageCatalogId $catalog.Id -ExpandProperty accessPackageResources
185+
$ar.AccessPackageResources
186+
```
169187

170188
## Remove resources from a catalog
171189

0 commit comments

Comments
 (0)