# RBAC to ABAC migration helper scripts: Notebook and PowerShell

**URL:** <https://community.dynatrace.com/t/rbac-to-abac-migration-helper-scripts-notebook-and-powershell/48091>\
**Category:** Dynatrace Tips\
**Tags:** user-management, notebooks, tips-and-tricks\
**Created:** [October 2, 2024, 12:45pm UTC](https://community.dynatrace.com/t/rbac-to-abac-migration-helper-scripts-notebook-and-powershell/48091 "2024-10-02T12:45:37Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jon2](https://avatars.discourse-cdn.com/v4/letter/j/e47774/32.png) [@Jon2](https://community.dynatrace.com/u/Jon2)\
**Post date:** [October 2, 2024, 12:45pm UTC](https://community.dynatrace.com/t/rbac-to-abac-migration-helper-scripts-notebook-and-powershell/48091/1 "2024-10-02T12:45:37Z")

</div>

The attached Zip file contains two scripts that are provided ‘as is’ to help Administrators planning on migrating their Dynatrace role-based permissions to attribute-based ones in order to leverage the IAM policies.

One script comes in the form of a Notebook export, which you can import and execute in your Dynatrace. The other is a PowerShell script which you can run from any machine with PowerShell installed and access to the Internet.

Both script serve the same purpose; they generate a list of RBAC permissions you have currently assigned to your groups. For each discoveredRBAC permission they also recommend potential replacement with permissions defined within policies.

Scripts connect to your Dynatrace using your provided OAuth token and generate&nbsp; current RBAC role assignments within your Dynatrace.

Pre-Reqs:

- Generate an OAuth Client within Account Management → Identity and access management → OAuth clients) with following permissions:
  - “View users and groups” = account-idm-read
  - “View and manage policies” = iam-policies-management, iam:policies:write, iam:policies:read, iam:bindings:write, iam:bindings:read, iam:effective-permissions:read
  - “View environments” = account-env-read, which allows reading ClientID and Secret from a credential  
[AssessRBACPermissions.zip](https://community.dynatrace.com/uploads/short-url/7kdBWcwCUydx5svJIQjeB6Ssd0h.zip) (6.06 KB)

---

<div class="post-metadata">

**Author:** ![JonU2](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@JonU2](https://community.dynatrace.com/u/JonU2)\
**Post date:** [November 4, 2024, 7:51am UTC](https://community.dynatrace.com/t/rbac-to-abac-migration-helper-scripts-notebook-and-powershell/48091/2 "2024-11-04T07:51:07Z")

</div>

Some users have reported and error when using credentialVault to retrieve your OAuth clientId/Secret and enable lines 47-57 of the notebook script. In this case, line 49 of this script (import { credentialVaultClient } from “@dynatrace-sdk/client-classic-environment-v2”😉 needs to go outside the export, so in line one.

---

<div class="post-metadata">

**Author:** ![pmilbrandt](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@pmilbrandt](https://community.dynatrace.com/u/pmilbrandt)\
**Post date:** [December 5, 2024, 8:24pm UTC](https://community.dynatrace.com/t/rbac-to-abac-migration-helper-scripts-notebook-and-powershell/48091/3 "2024-12-05T20:24:02Z")

</div>

The Notebook script times out after 120 seconds, is there a way to increase the timeout?

{  
“error”: {  
“code”: 541,  
“message”: “Execution crashed.”,  
“details”: {  
“logs”: “”,  
“type”: “TIMEOUT”,  
“message”: “Timeout limit (120s) exceeded”  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![Jon2](https://avatars.discourse-cdn.com/v4/letter/j/e47774/32.png) [@Jon2](https://community.dynatrace.com/u/Jon2)\
**Post date:** [December 6, 2024, 11:35am UTC](https://community.dynatrace.com/t/rbac-to-abac-migration-helper-scripts-notebook-and-powershell/48091/4 "2024-12-06T11:35:24Z")

</div>

This could be related to the default AppEngine 120 max execution timeout&nbsp;[AppEngine Functions (Serverless Functions)](https://docs.dynatrace.com/docs/manage/dynatrace-platform-subscription/capabilities/appengine-functions-serverless-functions)&nbsp;which I do not think is configurable.

Maybe consider doing the same but with the provided PowerShell script if that is possible for you. The syntax from a terminal window is:

AssessRBACPermissions.ps1 \<clientId\> \<clientSecret\>

---

<div class="post-metadata">

**Author:** ![pmilbrandt](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@pmilbrandt](https://community.dynatrace.com/u/pmilbrandt)\
**Post date:** [December 9, 2024, 3:55pm UTC](https://community.dynatrace.com/t/rbac-to-abac-migration-helper-scripts-notebook-and-powershell/48091/5 "2024-12-09T15:55:21Z")

</div>

After a bit of tweaking the powershell script, I was able to get that to run successfully.

Thanks!

---

<div class="post-metadata">

**Author:** ![pmilbrandt](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@pmilbrandt](https://community.dynatrace.com/u/pmilbrandt)\
**Post date:** [December 12, 2024, 1:48pm UTC](https://community.dynatrace.com/t/rbac-to-abac-migration-helper-scripts-notebook-and-powershell/48091/6 "2024-12-12T13:48:43Z")

</div>

Although I did get the powershell version of this to work, it doesn’t provide the same information that is listed in the documentation ([Migrate role-based permissions to Dynatrace IAM policies — Dynatrace Docs](https://docs.dynatrace.com/docs/manage/identity-access-management/permission-management/manage-user-permissions-policies/advanced/migrate-roles)).&nbsp; Namely it’s missing the recommended policies.&nbsp; That would be the part that would be especially helpful.

From documentation:

 ![Screenshot 2024-12-12 084257.png](https://global.discourse-cdn.com/dynatrace/original/3X/1/c/1c75436c0cc172984c5dfb0746936705501b4e33.png)

Actual powershell results:

 ![Screenshot 2024-12-12 084326.png](https://global.discourse-cdn.com/dynatrace/original/3X/a/7/a7b786ac1b239f5139b1736c7495a6ec7130522e.png)

---

<div class="post-metadata">

**Author:** ![Jon2](https://avatars.discourse-cdn.com/v4/letter/j/e47774/32.png) [@Jon2](https://community.dynatrace.com/u/Jon2)\
**Post date:** [December 12, 2024, 2:40pm UTC](https://community.dynatrace.com/t/rbac-to-abac-migration-helper-scripts-notebook-and-powershell/48091/7 "2024-12-12T14:40:47Z")

</div>

Most likely a screen res. issue on the terminal window. Lower res should show it.

Alternatively, since you already touched the ps file, you can instead export out to .csv  
Replace this line at the end of the script:

$candidateRBACPermissions | Format-Table -AutoSize -Wrap

with this:  
$candidateRBACPermissions | Export-Csv -path ./Output.csv

If running Windows OS might need to tweak the path…

---

<div class="post-metadata">

**Author:** ![pmilbrandt](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@pmilbrandt](https://community.dynatrace.com/u/pmilbrandt)\
**Post date:** [December 12, 2024, 9:17pm UTC](https://community.dynatrace.com/t/rbac-to-abac-migration-helper-scripts-notebook-and-powershell/48091/8 "2024-12-12T21:17:10Z")

</div>

Thanks Jon, CSV is a much better options for us anyway, great suggestion.

---

<div class="post-metadata">

**Author:** ![Jon2](https://avatars.discourse-cdn.com/v4/letter/j/e47774/32.png) [@Jon2](https://community.dynatrace.com/u/Jon2)\
**Post date:** [March 19, 2025, 2:34pm UTC](https://community.dynatrace.com/t/rbac-to-abac-migration-helper-scripts-notebook-and-powershell/48091/9 "2025-03-19T14:34:45Z")

</div>

Some users are reporting the PowerShell script is not filling out last to columns.

It turns out some older versions of PowerShell do not seem to interpret this line well for the PSCustomObject:  
if ($recommend.length -gt 0)

If that’s your case, consider changing it to:if ($null -ne&nbsp;$recommend)
