This tool helps in taking all the application segments and global policies in your ZPA and saves it in CSV format.
This tool is developed to help administrators to export a copy of all application segments and global policies published in Zscaler Private Access.
Requirements for installation:
1. pip3 install requests
2. ZPA API Key
3. ZPA Customer ID
To run this project, you will need to add the following environment variables to your .env file or to your ~/.profile.
export ZPA_CL_ID='Zscaler Client ID'
export ZPA_SC='Zscaler Secret Key'
Replace the tenant and customer id.
base_path = "https://config.beta.zscaler.com"
customer_id = "72064120XXXXXXXXX"
git clone [email protected]:meliodaaf/csvAppSegExportZPA.git
./appsegments.py
Sample run. As you can see, it does support pagination. This helps when you organization has a lot of application segments published.
[*] Authentication successful!
[*] Retrieving apps from page 1.
[*] Retrieving apps from page 2.
[*] Retrieving apps from page 3.
[*] Retrieving apps from page 4.
[*] Retrieving apps from page 5.
[*] Retrieving apps from page 6.
[*] Retrieving apps from page 7.
Reached last page.
[*] Retrieving Global Policies
GET /mgmtconfig/v1/admin/customers/{customerId}/application
Parameter | Type | Description |
---|---|---|
api_key |
string |
Required. Your API key |
GET /mgmtconfig/v1/admin/customers/{customerId}/application?page=1&pagesize=500
Parameter | Type | Description |
---|---|---|
page |
string |
Default value: 1 |
pagesize |
string |
Value is up to 500 |
GET /mgmtconfig/v1/admin/customers/{customerId}/policySet/global
1. Add export for Policies - Done
2. Correlate Application Segments and Policies