<?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: Need help with scripting to add member to address group using pandevice command (Python) in Automation/API Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/need-help-with-scripting-to-add-member-to-address-group-using/m-p/516617#M3188</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/54402"&gt;@mohan.alagar&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;First I would consider moving to importing pan-os-python instead of pandevice for your Python scripts (&lt;A href="https://github.com/PaloAltoNetworks/pan-os-python#upgrade-from-pandevice" target="_self"&gt;reference here&lt;/A&gt;). From there you will find the docs &lt;A href="https://pan-os-python.readthedocs.io/en/latest/" target="_self"&gt;here&lt;/A&gt;, including the syntax for AddressGroup &lt;A href="https://pan-os-python.readthedocs.io/en/latest/module-objects.html#panos.objects.AddressGroup" target="_self"&gt;here&lt;/A&gt;. It would be something like this as an example:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;new_group = "new-address-group"
new_group_members = [new_object_one, new_object_two]
fw.add(AddressGroup(name=new_group, static_value=new_group_members)).create()&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is &lt;A href="https://github.com/jamesholland-uk/playground/blob/main/pan-os-python/create-ngfw-addressobj-and-addressgrp.py" target="_self"&gt;a working example&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope that helps!&lt;/P&gt;</description>
    <pubDate>Mon, 03 Oct 2022 11:44:47 GMT</pubDate>
    <dc:creator>JimmyHolland</dc:creator>
    <dc:date>2022-10-03T11:44:47Z</dc:date>
    <item>
      <title>Need help with scripting to add member to address group using pandevice command (Python)</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/need-help-with-scripting-to-add-member-to-address-group-using/m-p/516379#M3184</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working to get automation script for creating address objects and binding it to address group. I was able to get the script ready and tested working for adding address objects to a firewall using API call. The script is written with pandevice in python. However, I am looking for syntax/command of pandevice to add those address objects to a address group - new/existing, has anyone used it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pandevice command on python to create address object:&lt;/P&gt;&lt;P&gt;import pandevice&lt;/P&gt;&lt;P&gt;fw = firewall.Firewall(&amp;lt;firewall_IP&amp;gt;, &amp;lt;api_Key&amp;gt;)&lt;/P&gt;&lt;P&gt;fw.add(AddressObject(&amp;lt;address_obj_name&amp;gt;,&amp;lt;IP_address&amp;gt;, &amp;lt;description&amp;gt;)).create()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking for pandevice syntax to add a address object to a address group (exiting or new group). Please guide.&lt;/P&gt;&lt;P&gt;#api #pandevice #python #automation&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 16:14:05 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/need-help-with-scripting-to-add-member-to-address-group-using/m-p/516379#M3184</guid>
      <dc:creator>mohan.alagar</dc:creator>
      <dc:date>2022-09-29T16:14:05Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with scripting to add member to address group using pandevice command (Python)</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/need-help-with-scripting-to-add-member-to-address-group-using/m-p/516617#M3188</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/54402"&gt;@mohan.alagar&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;First I would consider moving to importing pan-os-python instead of pandevice for your Python scripts (&lt;A href="https://github.com/PaloAltoNetworks/pan-os-python#upgrade-from-pandevice" target="_self"&gt;reference here&lt;/A&gt;). From there you will find the docs &lt;A href="https://pan-os-python.readthedocs.io/en/latest/" target="_self"&gt;here&lt;/A&gt;, including the syntax for AddressGroup &lt;A href="https://pan-os-python.readthedocs.io/en/latest/module-objects.html#panos.objects.AddressGroup" target="_self"&gt;here&lt;/A&gt;. It would be something like this as an example:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;new_group = "new-address-group"
new_group_members = [new_object_one, new_object_two]
fw.add(AddressGroup(name=new_group, static_value=new_group_members)).create()&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is &lt;A href="https://github.com/jamesholland-uk/playground/blob/main/pan-os-python/create-ngfw-addressobj-and-addressgrp.py" target="_self"&gt;a working example&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope that helps!&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 11:44:47 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/need-help-with-scripting-to-add-member-to-address-group-using/m-p/516617#M3188</guid>
      <dc:creator>JimmyHolland</dc:creator>
      <dc:date>2022-10-03T11:44:47Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with scripting to add member to address group using pandevice command (Python)</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/need-help-with-scripting-to-add-member-to-address-group-using/m-p/516767#M3194</link>
      <description>&lt;P&gt;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/4294"&gt;@JimmyHolland&lt;/a&gt;&amp;nbsp;Thank you very much. That worked. I actually was missing to import AddressGroup.&amp;nbsp; post adding it worked for me on both version of script pan-os-python &amp;amp; pandevice. As suggested I upgraded to pan-os-python.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;import panos&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;from&lt;/SPAN&gt; &lt;SPAN class=""&gt;panos&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;objects&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class=""&gt;import&lt;/SPAN&gt; &lt;SPAN class=""&gt;AddressObject&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;AddressGroup&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;Mohan A&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2022 14:38:49 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/need-help-with-scripting-to-add-member-to-address-group-using/m-p/516767#M3194</guid>
      <dc:creator>mohan.alagar</dc:creator>
      <dc:date>2022-10-04T14:38:49Z</dc:date>
    </item>
  </channel>
</rss>

