Before we script the logic, we define the "Interface" in
ServiceNow. This centralizes the endpoints so that if the API
version updates, you change it in one place rather than in every
script.
Path:System Web Services > Outbound > REST
Messages
Native OAuth 2.0 Integration involves three main ServiceNow
components:
Application Registry: Defines the external
system (Prisma Access) as an OAuth provider.
OAuth 2.0 Credentials: Stores your client
secret and links it to the provider profile.
Outbound REST Message: Uses the credential
to automatically inject the Bearer token into your POST
requests.
Register an Application
Before ServiceNow can request a token, it must know where
to send the request.
Navigate to All > System OAuth > Application
Registry and click New.
Select Connect to a third party OAuth
Provider.
Name: Prisma Access.
Client ID & Client Secret: Insert
your ID and Secret obtained in Step 1
Token URL:
https://auth.apps.paloaltonetworks.com/oauth2/access_token
Default Grant Type: Client
Credentials for this system-to-system
integration.
- OAuth entity profile will be created automatically.
Create the Credential Record
This record acts as the "key" ServiceNow uses to
authenticate.
Navigate to All > Connections & Credentials
> Credentials and click New.
Select OAuth 2.0 Credentials.
Name: Prisma Access Creds.
OAuth Entity Profile: Select the profile
automatically created in Step 1.
Click
Submit. Open the record again and
click the
Get OAuth Token related link to verify
ServiceNow can successfully reach the external system and
receive a token.
Open the record again and click the Get OAuth Token
related link to verify ServiceNow can successfully reach the
external system and receive a token.
Create the Connection Alias
Navigate to All > Connections &
Credentials > Connection Aliases and click
New.
Name: Prisma_Access_Alias.
Type: Connection & Credential.
Configuration Tier: External.
Submit.
Now you need to add a connection.
Link the Connection and Credentials
Once the Alias is created, you must define the "Connection"
record that tells the Alias where to go.
Open your new Alias and click the
Connections related list, then click
New.
Name: Prisma Access Connection For Alias
Connection URL: Your Prisma Access API POST
URL: https://api.sase.paloaltonetworks.com
Credential: Select the OAuth 2.0
Credentials you created in the previous turn.
Create an Outbound REST Message
This REST Message will be used to both pull user-requests
from the Prisma API into the ServiceNow table and to post
updates.
Navigate to Outbound REST Message and click
New.
Define the REST Message:
Name: Prisma Access Integration
Description: Outbound request to
Prisma API
Endpoint:
https://api.sase.paloaltonetworks.com/
Authentication: OAuth 2.0, pick the
profile created earlier.
Click Submit.
Open the Prisma Access Integration record to
open it to configure HTTP Methods.
Even though it is possible to manually define HTTP POST and
GET URLs for each request, having these centrally managed is better
in production.