Skip to content

Commit 12a9689

Browse files
committed
move to psh v2 syntax
1 parent 9db5a5b commit 12a9689

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

articles/active-directory/governance/entitlement-management-access-package-resources.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -191,21 +191,21 @@ You can add a resource role to an access package using Microsoft Graph. A user i
191191

192192
### Add resource roles to an access package with Microsoft PowerShell
193193

194-
You can also create an access package in PowerShell with the cmdlets from the [Microsoft Graph PowerShell cmdlets for Identity Governance](https://www.powershellgallery.com/packages/Microsoft.Graph.Identity.Governance/) module version 1.16.0 or a later 1.x.x module version, or Microsoft Graph PowerShell cmdlets beta module version 2.1.x or later beta module version. This script illustrates using the Graph `beta` profile and Microsoft Graph PowerShell cmdlets module version 1.x.x.
194+
You can also create an access package in PowerShell with the cmdlets from the [Microsoft Graph PowerShell cmdlets for Identity Governance](https://www.powershellgallery.com/packages/Microsoft.Graph.Identity.Governance/) beta module version 2.1.x or later beta module version. This script illustrates using the Graph `beta` profile and Microsoft Graph PowerShell cmdlets module version 2.4.0.
195195

196-
First, you would retrieve the ID of the catalog, and of the resources and their roles in that catalog that you wish to include in the access package, using a script similar to the following.
196+
First, you would retrieve the ID of the catalog, and of the resource and their roles in that catalog that you wish to include in the access package, using a script similar to the following. This assumes there is a single application resource in the catalog.
197197

198198
```powershell
199199
Connect-MgGraph -Scopes "EntitlementManagement.ReadWrite.All"
200-
Select-MgProfile -Name "beta"
201-
$catalog = Get-MgEntitlementManagementAccessPackageCatalog -Filter "displayName eq 'Marketing'"
202200
203-
$rsc = Get-MgEntitlementManagementAccessPackageCatalogAccessPackageResource -AccessPackageCatalogId $catalog.Id -Filter "resourceType eq 'Application'" -ExpandProperty "accessPackageResourceScopes"
204-
$filt = "(originSystem eq 'AadApplication' and accessPackageResource/id eq '" + $rsc[0].Id + "')"
205-
$rr = Get-MgEntitlementManagementAccessPackageCatalogAccessPackageResourceRole -AccessPackageCatalogId $catalog.Id -Filter $filt -ExpandProperty "accessPackageResource"
201+
$catalog = Get-MgBetaEntitlementManagementAccessPackageCatalog -Filter "displayName eq 'Marketing'"
202+
203+
$rsc = Get-MgBetaEntitlementManagementAccessPackageCatalogAccessPackageResource -AccessPackageCatalogId $catalog.Id -Filter "resourceType eq 'Application'" -ExpandProperty "accessPackageResourceScopes"
204+
$filt = "(originSystem eq 'AadApplication' and accessPackageResource/id eq '" + $rsc.Id + "')"
205+
$rr = Get-MgBetaEntitlementManagementAccessPackageCatalogAccessPackageResourceRole -AccessPackageCatalogId $catalog.Id -Filter $filt -ExpandProperty "accessPackageResource"
206206
```
207207

208-
Then, assign the resource roles to the access package. For example, if you wished to include the second resource role of the first resource returned earlier as a resource role of an access package, you would use a script similar to the following.
208+
Then, assign the resource role from that resource to the access package. For example, if you wished to include the second resource role of the resource returned earlier as a resource role of an access package, you would use a script similar to the following.
209209

210210
```powershell
211211
$apid = "cdd5f06b-752a-4c9f-97a6-82f4eda6c76d"
@@ -216,18 +216,18 @@ $rparams = @{
216216
DisplayName = $rr[2].DisplayName
217217
OriginSystem = $rr[2].OriginSystem
218218
AccessPackageResource = @{
219-
Id = $rsc[0].Id
220-
ResourceType = $rsc[0].ResourceType
221-
OriginId = $rsc[0].OriginId
222-
OriginSystem = $rsc[0].OriginSystem
219+
Id = $rsc.Id
220+
ResourceType = $rsc.ResourceType
221+
OriginId = $rsc.OriginId
222+
OriginSystem = $rsc.OriginSystem
223223
}
224224
}
225225
AccessPackageResourceScope = @{
226-
OriginId = $rsc[0].OriginId
227-
OriginSystem = $rsc[0].OriginSystem
226+
OriginId = $rsc.OriginId
227+
OriginSystem = $rsc.OriginSystem
228228
}
229229
}
230-
New-MgEntitlementManagementAccessPackageResourceRoleScope -AccessPackageId $apid -BodyParameter $rparams
230+
New-MgBetaEntitlementManagementAccessPackageResourceRoleScope -AccessPackageId $apid -BodyParameter $rparams
231231
```
232232

233233
## Remove resource roles

0 commit comments

Comments
 (0)