<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Export User Access Roles and Import to new CMA in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Export-User-Access-Roles-and-Import-to-new-CMA/m-p/128736#M6215</link>
    <description>&lt;P&gt;One of my customers has this exact requirement and I believe I found a solution in my lab.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lab environment:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[Expert@mds:0]# clish -c 'show asset system' | grep Model
Model: Smart-1 5050
[Expert@mds:0]# cat /etc/*-release
Multi-Domain Security Management R80.40
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Step 1. Getting the objects from the appropriate domain:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[Expert@mds:0]# mgmt_cli login user your_user password your_password domain "your_domain1" &amp;gt; id.txt

[Expert@mds:0]# mgmt_cli show access-roles details-level "full" --format json -s id.txt | $CPDIR/jq/jq '.objects[] | [ .["name"], .["networks"], .["users"], .["machines"], .["remote-access-clients"] ] | @csv' -r &amp;gt; access-roles.csv
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Step 2. Adding values to top row of .csv file:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[Expert@mds:0]# cat access-roles.csv
"test_ar1","any","any","any",
"test_ar2","any","any","any",
"test_ar3","any","any","any",
[Expert@mds:0]# vim access-roles.csv
[Expert@mds:0]# cat access-roles.csv
"name","networks","users","machines","remote-access-clients",
"test_ar1","any","any","any",
"test_ar2","any","any","any",
"test_ar3","any","any","any",

&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Step 3. Log into target domain and add objects:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[Expert@mds:0]# mgmt_cli login user your_user password your_password domain "your_domain2" &amp;gt; id.txt
[Expert@mds:0]# mgmt_cli show access-roles details-level "full" --format json -s id.txt | $CPDIR/jq/jq '.objects[] | [ .["name"], .["networks"], .["users"], .["machines"], .["remote-access-clients"] ] | @csv' -r
[Expert@mds:0]#
[Expert@mds:0]# mgmt_cli add access-role --batch access-roles.csv -s id.txt
[Expert@mds:0]# mgmt_cli show access-roles details-level "full" --format json -s id.txt | $CPDIR/jq/jq '.objects[] | [ .["name"], .["networks"], .["users"], .["machines"], .["remote-access-clients"] ] | @csv' -r
"test_ar1","any","any","any",
"test_ar2","any","any","any",
"test_ar3","any","any","any",&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would recommend testing this method out in a non-production environment to be safe. It all appears to work fine in my lab.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 05 Sep 2021 04:12:19 GMT</pubDate>
    <dc:creator>mcatanzaro</dc:creator>
    <dc:date>2021-09-05T04:12:19Z</dc:date>
    <item>
      <title>Export User Access Roles and Import to new CMA</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Export-User-Access-Roles-and-Import-to-new-CMA/m-p/128651#M6213</link>
      <description>&lt;P&gt;Is there a way to export User Access Roles via the API and then add them to a different CMA?&amp;nbsp; I would prefer not to have to recreate them manually. I have some examples for network objects, but cannot figure out the access roles.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Sep 2021 14:35:38 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Export-User-Access-Roles-and-Import-to-new-CMA/m-p/128651#M6213</guid>
      <dc:creator>ChckPnt82</dc:creator>
      <dc:date>2021-09-02T14:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: Export User Access Roles and Import to new CMA</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Export-User-Access-Roles-and-Import-to-new-CMA/m-p/128673#M6214</link>
      <description>&lt;P&gt;Yeah, you can list the access roles with show access-roles:&amp;nbsp;&amp;nbsp;&lt;A href="https://sc1.checkpoint.com/documents/latest/APIs/#cli/show-access-roles~v1.8%20" target="_blank"&gt;https://sc1.checkpoint.com/documents/latest/APIs/#cli/show-access-roles~v1.8%20&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;You'd probably have to then list each one with show access-role uid xxxx,&lt;BR /&gt;And, presumably, create them with add access-role.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Sep 2021 23:00:00 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Export-User-Access-Roles-and-Import-to-new-CMA/m-p/128673#M6214</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2021-09-02T23:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: Export User Access Roles and Import to new CMA</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Export-User-Access-Roles-and-Import-to-new-CMA/m-p/128736#M6215</link>
      <description>&lt;P&gt;One of my customers has this exact requirement and I believe I found a solution in my lab.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lab environment:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[Expert@mds:0]# clish -c 'show asset system' | grep Model
Model: Smart-1 5050
[Expert@mds:0]# cat /etc/*-release
Multi-Domain Security Management R80.40
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Step 1. Getting the objects from the appropriate domain:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[Expert@mds:0]# mgmt_cli login user your_user password your_password domain "your_domain1" &amp;gt; id.txt

[Expert@mds:0]# mgmt_cli show access-roles details-level "full" --format json -s id.txt | $CPDIR/jq/jq '.objects[] | [ .["name"], .["networks"], .["users"], .["machines"], .["remote-access-clients"] ] | @csv' -r &amp;gt; access-roles.csv
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Step 2. Adding values to top row of .csv file:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[Expert@mds:0]# cat access-roles.csv
"test_ar1","any","any","any",
"test_ar2","any","any","any",
"test_ar3","any","any","any",
[Expert@mds:0]# vim access-roles.csv
[Expert@mds:0]# cat access-roles.csv
"name","networks","users","machines","remote-access-clients",
"test_ar1","any","any","any",
"test_ar2","any","any","any",
"test_ar3","any","any","any",

&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Step 3. Log into target domain and add objects:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[Expert@mds:0]# mgmt_cli login user your_user password your_password domain "your_domain2" &amp;gt; id.txt
[Expert@mds:0]# mgmt_cli show access-roles details-level "full" --format json -s id.txt | $CPDIR/jq/jq '.objects[] | [ .["name"], .["networks"], .["users"], .["machines"], .["remote-access-clients"] ] | @csv' -r
[Expert@mds:0]#
[Expert@mds:0]# mgmt_cli add access-role --batch access-roles.csv -s id.txt
[Expert@mds:0]# mgmt_cli show access-roles details-level "full" --format json -s id.txt | $CPDIR/jq/jq '.objects[] | [ .["name"], .["networks"], .["users"], .["machines"], .["remote-access-clients"] ] | @csv' -r
"test_ar1","any","any","any",
"test_ar2","any","any","any",
"test_ar3","any","any","any",&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would recommend testing this method out in a non-production environment to be safe. It all appears to work fine in my lab.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Sep 2021 04:12:19 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Export-User-Access-Roles-and-Import-to-new-CMA/m-p/128736#M6215</guid>
      <dc:creator>mcatanzaro</dc:creator>
      <dc:date>2021-09-05T04:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: Export User Access Roles and Import to new CMA</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Export-User-Access-Roles-and-Import-to-new-CMA/m-p/129434#M6236</link>
      <description>&lt;P&gt;Step 4: publish&lt;/P&gt;
&lt;P&gt;Step 5: logout&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;You can also skip Step 2 - create empty file where you will add headers and then append the file with the output from API command. No need to do manual work anymore.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Sep 2021 18:34:18 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Export-User-Access-Roles-and-Import-to-new-CMA/m-p/129434#M6236</guid>
      <dc:creator>JozkoMrkvicka</dc:creator>
      <dc:date>2021-09-14T18:34:18Z</dc:date>
    </item>
  </channel>
</rss>

