<?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: How to add a new admin user via the API in General Topics</title>
    <link>https://live.paloaltonetworks.com/t5/general-topics/how-to-add-a-new-admin-user-via-the-api/m-p/224194#M64403</link>
    <description>&lt;P&gt;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/94191"&gt;@RogerMccarrick&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I don't think this is actually possible. The API will give you the phash value and you might be able to actually set that value, but that wouldn't really help you at all.&lt;/P&gt;</description>
    <pubDate>Tue, 31 Jul 2018 17:33:35 GMT</pubDate>
    <dc:creator>BPry</dc:creator>
    <dc:date>2018-07-31T17:33:35Z</dc:date>
    <item>
      <title>How to add a new admin user via the API</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/how-to-add-a-new-admin-user-via-the-api/m-p/224186#M64401</link>
      <description>&lt;P&gt;I'm working on a script to deploy new Palo Alto firewalls in vmware from template, using powershell.&lt;/P&gt;&lt;P&gt;I'm doing this with API calls in the powershell code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for instance, change hostname:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$hnURL = "https://myPA//api/?key=" + &lt;FONT color="#99CC00"&gt;$apiKey&lt;/FONT&gt; + "&amp;amp;type=config&amp;amp;action=edit&amp;amp;xpath=/config/devices/entry[@name='localhost.localdomain']/deviceconfig/system/hostname&amp;amp;element=&amp;lt;hostname&amp;gt;&lt;FONT color="#99CC00"&gt;$myHostname&lt;/FONT&gt;&amp;lt;/hostname&amp;gt;"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Invoke-WebRequest -uri $hnURL&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to do something similar to add a new user "apiadmin", and password.&lt;/P&gt;&lt;P&gt;I have googled and found how to add a user on the CLI, but I'm hoping to be able to do it via the API.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Roger&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jul 2018 17:19:15 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/how-to-add-a-new-admin-user-via-the-api/m-p/224186#M64401</guid>
      <dc:creator>RogerMccarrick</dc:creator>
      <dc:date>2018-07-31T17:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new admin user via the API</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/how-to-add-a-new-admin-user-via-the-api/m-p/224194#M64403</link>
      <description>&lt;P&gt;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/94191"&gt;@RogerMccarrick&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I don't think this is actually possible. The API will give you the phash value and you might be able to actually set that value, but that wouldn't really help you at all.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jul 2018 17:33:35 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/how-to-add-a-new-admin-user-via-the-api/m-p/224194#M64403</guid>
      <dc:creator>BPry</dc:creator>
      <dc:date>2018-07-31T17:33:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new admin user via the API</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/how-to-add-a-new-admin-user-via-the-api/m-p/224250#M64417</link>
      <description>&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I will create the user ahead of time. But then I want to use the API to change the password of that account in each new FW so that I can then generate a new API key.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can get the phash of the NEW PASSWORD.&lt;/P&gt;&lt;P&gt;&amp;lt;request&amp;gt;&amp;lt;password-hash&amp;gt;&amp;lt;password&amp;gt;NEWPASSWORD&amp;lt;/password&amp;gt;&amp;lt;/password-hash&amp;gt;&amp;lt;/request&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know how I set the new password using th API and phash.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I read an article but it didn't work for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jul 2018 22:41:27 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/how-to-add-a-new-admin-user-via-the-api/m-p/224250#M64417</guid>
      <dc:creator>RogerMccarrick</dc:creator>
      <dc:date>2018-07-31T22:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new admin user via the API</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/how-to-add-a-new-admin-user-via-the-api/m-p/224251#M64418</link>
      <description>&lt;P&gt;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/94191"&gt;@RogerMccarrick&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Here's the thing with that, if you follow best practices this&amp;nbsp;&lt;STRONG&gt;isn't&lt;/STRONG&gt; going to work. Unless you keep the devices master key the exact same between all units, and you use the exact same password on all devices, the &lt;SPAN class="mce-spellchecker-word"&gt;phash&lt;/SPAN&gt; value isn't interpreted&amp;nbsp;the same.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I&amp;nbsp;&lt;STRONG&gt;really&lt;/STRONG&gt; recommend that this not be something you script as it breaks multiple best practices.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jul 2018 23:15:38 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/how-to-add-a-new-admin-user-via-the-api/m-p/224251#M64418</guid>
      <dc:creator>BPry</dc:creator>
      <dc:date>2018-07-31T23:15:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new admin user via the API</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/how-to-add-a-new-admin-user-via-the-api/m-p/224289#M64423</link>
      <description>&lt;P&gt;There is an article at called "&lt;SPAN&gt;How to Change the Password of Administrative Users via XML AP" at&amp;nbsp;&lt;/SPAN&gt; &lt;A href="https://live.paloaltonetworks.com/t5/Management-Articles/How-to-Change-the-Password-of-Administrative-Users-via-XML-API/ta-p/75525&amp;nbsp;" target="_blank"&gt;https://live.paloaltonetworks.com/t5/Management-Articles/How-to-Change-the-Password-of-Administrative-Users-via-XML-API/ta-p/75525&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to follow the article but it didnt work. The article doesn't show complete commands and I think it has a mistake.&lt;/P&gt;&lt;P&gt;But however I do this, I will want to know how to change the password of an account via API.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My idea is to:&lt;/P&gt;&lt;P&gt;Deploy PA&lt;/P&gt;&lt;P&gt;Run a powershell command I have to generate a new password.&lt;/P&gt;&lt;P&gt;Use the API to get the phash of that password,&amp;nbsp;with powershell.&lt;/P&gt;&lt;P&gt;Use the API to change the password of the apiadmin account, with powershell.&lt;/P&gt;&lt;P&gt;Generate an api key with apiadmin and new password, all in powershell.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't ever need to know what that password is. It is all generated in the running of instance of the powershell script, used in that instance and the only thing I keep is the API key.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wil never access the PA again with the password. Only the API key.&lt;/P&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Aug 2018 14:44:25 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/how-to-add-a-new-admin-user-via-the-api/m-p/224289#M64423</guid>
      <dc:creator>RogerMccarrick</dc:creator>
      <dc:date>2018-08-01T14:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new admin user via the API</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/how-to-add-a-new-admin-user-via-the-api/m-p/224436#M64436</link>
      <description>&lt;P&gt;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/94191"&gt;@RogerMccarrick&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;The command to do something like this would look like this.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;api/?type=config&amp;amp;action=set&amp;amp;key=YOURKEY&amp;amp;xpath=/config/mgt-config/users/entry[@name='test']&amp;amp;element=&amp;lt;phash&amp;gt;PHASHVALUE&amp;lt;/phash&amp;gt;&lt;/PRE&gt;&lt;P&gt;Just to point out once again, I'm not seeing what you're attempting to do here. You specifically call out that you are setting the password to a known value in some powershell script, then you get the phash for some reason, then you change the password using a phash value again, then you get the API key?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not seeing the point in all the run-around with setting the password. If you're doing it once already just set it to a secure password the first time, generate the api-key and be done with it. It appears that you have two password changes in your script that has you changing the password once, then modifying the phash directly, then getting the API key. I'm missing why you would ever need to modify the phash directly if you're already setting the password once.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Aug 2018 15:04:08 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/how-to-add-a-new-admin-user-via-the-api/m-p/224436#M64436</guid>
      <dc:creator>BPry</dc:creator>
      <dc:date>2018-08-01T15:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new admin user via the API</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/how-to-add-a-new-admin-user-via-the-api/m-p/224631#M64478</link>
      <description>&lt;P&gt;Thanks for the command. It worked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Each time I deploy a PA, I&amp;nbsp;want to do all (or as much as I can) (of) the deployment with a single powershell script doing API calls to configure the PA.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Each PA&amp;nbsp;has an apiadmin account, specifically for doing API calls for future configurations. And each PA will have to have a different API-Key. So I have to change the password of the apiadmin account (without manually logging in) to something different on each PA to achieve this. I will store all API keys in a database.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I deploy a new PA, it is a clone of the template, all passwords and keys are the same for each one. I am using the script to automate changing passwords and generating new API keys.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So from powershell script:&lt;/P&gt;&lt;P&gt;&amp;nbsp; deploy new PA from VMware template, has known password for apiadmin account.&lt;/P&gt;&lt;P&gt;&amp;nbsp; generate random password.&lt;/P&gt;&lt;P&gt;&amp;nbsp; send api call to new PA to get hash of that new password&lt;/P&gt;&lt;P&gt;&amp;nbsp; api call to with that hash to change the apiadmin password (the command you showed me).&lt;/P&gt;&lt;P&gt;&amp;nbsp; api call to PA using apiadmin and new password to generate new API key for apiadmin&lt;/P&gt;&lt;P&gt;&amp;nbsp; store new PA name and apiadmin API key in database.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do all the api calls using the default admin account, and then when done change the password and key of the admin account.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your help.&lt;/P&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;</description>
      <pubDate>Thu, 02 Aug 2018 17:39:06 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/how-to-add-a-new-admin-user-via-the-api/m-p/224631#M64478</guid>
      <dc:creator>RogerMccarrick</dc:creator>
      <dc:date>2018-08-02T17:39:06Z</dc:date>
    </item>
  </channel>
</rss>

