Palo Alto Networks - Prisma Advanced Tools
[toc]
Advanced Tools
–
Prisma Cloud API
Prisma Cloud REST API
representational state transfer (REST) API
that Prisma Cloud supports.- Application programming interfaces (APIs) allow one software program to communicate with another.
- The REST API works like a web server where an API call is made from a client and sent to a server.
- REST uses the HTTP protocol where data is exchanged using JSON structured data, and uses
HTTP methods POST, PUT, GET, OPTIONS, DELETE, and PATCH
to read and write data.
Prisma Cloud has a REST API that allows to configure custom integrations for cloud security needs.
- Create Access Key
- Admin generates
Access Key
andSecret Key
.
- Admin generates
- Submit Login API Request
- The user submits the
login API request
to generate the token and to receive the token back from the API call.
- The user submits the
- REST API Server
- Processes the
JSON Web Token (JWT) Request
andreturns the token
to the requester.
- Processes the
- JWT Returned
- The JWT is valid for 10min, and must be refreshed for continued access to the Prisma Cloud API.
- If an API request is made with an expired JWT request, the request will return an
HTTP 401 Unauthorized response
- Use JWT
- The JWT then is used to authenticate all subsequent
REST API
requests on Prisma Cloud.
- The JWT then is used to authenticate all subsequent
Logging In
- The API can be accessed via the API Docs > Help Center > API.
- Using Prisma Cloud Login
- Using the Access Key Login
- In order to generate an Access Key, must be a user with a system admin role.
- generate an Access Key
- Downloading the Access Key and Secret Key
- From the API Key Generated dialog box, can download a copy of the Access Key ID and Secret Key to a
.CSV
file. - There are also options to copy and paste the values.
- must select the download option to continue.
- This is the only opportunity to download the Secret Key.
- If it is lost or deleted, must generate a new Access Key.
- are limited to a maximum of two Access Keys.
- From the API Key Generated dialog box, can download a copy of the Access Key ID and Secret Key to a
- Updating an Access Key
- After generate an Access Key, it is listed in the Access Keys table.
- The keys are listed by the Access Key ID.
- can update an Access Key from the table.
- This provides the opportunity to update the Key Expiry date and extend use of the key.
Demo: Accessing the API Reference
help center > doc > api > api reference
Interactive CLI Tool
The Interactive CLI tool can be used to extract data
and automate manual workflows
.
- Commands supported by the CLI can present a series of questions that can help with
- bulk onboarding and deboarding of cloud accounts,
- getting the status of cloud accounts,
- role-based access control (RBAC),
- fetching relevant alerts and policies,
- and cloning policies from within and across accounts.
The CLI Tool
- CLI Tool Installation
- can be installed and executed from the Windows Powershell.
- Requires Node.js
npm I –g redlock-cli
to install the JavaScript runtime on local system.
- Enabling Scripts
- enable execution of scripts on your system.
- If you receive an error that scripts are disabled on your system, you can run a command to allow script execution.
- For Windows 10:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
- Using the CLI Tool
redlock-cli command
- Creating a Profile to use for authentication.
- Testing the CLI Connection
- login
redlock-cli login
redlock-cli cloud-account fetch > 1.json
redlock-cli users add
help center > doc > api > api reference > CLI
.
This post is licensed under CC BY 4.0 by the author.
Comments powered by Disqus.