< Previous Module - Home - Next Module>
- An Azure account with an active subscription.
- An Azure Azure Purview account (see module 01).
- Postman (Download and Install)
In addition to Purview Studio, the Azure Purview platform can be accessed via an API. This enables users to submit data directly to the catalog, include the catalog as part of an automated process, or build their own user experience on top of the catalog.
- Return data from the Azure Purview REST API.
- Register an Application
- Generate a Client Secret
- Provide Service Principal Access to Azure Purview
- Use Postman to Call Azure Purview REST API
To invoke the REST API, we must first register an application (i.e. service principal) that will act as the identity that the Azure Purview platform reognizes and is configured to trust.
💡 Did you know?
An Azure service principal is an identity created for use with applications, hosted services, and automated tools to access Azure resources.
-
Sign in to the Azure portal, navigate to Azure Active Directory > App registrations, and click New registration.
-
Provide the application a name, select an account type, and click Register.
Property Example Value Name purview-spn
Account Type Accounts in this organizational directory only - Single tenant Redirect URI (optional) Leave blank -
Copy the following values for later use.
- Application (client) ID
- Directory (tenant) ID
-
Navigate to Certifications & secrets and click New client secret.
-
Provide a Description and set the expiration to
In 1 year
, click Add.Property Example Value Description purview-api
Expires In 1 year
-
Copy the client secret value for later use.
💡 Did you know?
A client secret is a secret string that the application uses to prove its identity when requesting a token, this can also can be referred to as an application password.
-
Under the Azure Purview account, navigate to Access control (IAM) and click Add role assignments.
-
Select the Purview Data Curator role, select the service principal and click Save.
-
Open Postman, create a new HTTP request as per the details below.
💡 Did you know?
The OAuth2 service endpoint is used to gain access to protected resources such as Azure Purview. The HTTP request enables us to acquire an
access_token
in a way that is language agnostic, this will subsequently be used to query the Azure Purview API.Property Value HTTP Method POST
URL https://login.microsoftonline.com/YOUR_TENANT_ID/oauth2/token
Body Type x-wwww-form-urlencoded
Navigate to Body, select
x-wwww-form-urlencoded
and provide the following key value pairs. Once HTTP request is ready, click Send. If successful, the response will contain an access token, copy this value for later use.Form Key Form Value grant_type client_credentials
client_id YOUR_CLIENT_ID
client_secret YOUR_CLIENT_SECRET
resource https://purview.azure.net
-
Within the Azure portal, open the Azure Purview account, navigate to Properties and find the Atlas endpoint. Copy this value for later use.
💡 Did you know?
The Azure Purview catalog endpoint is largely based on the open source Apache Atlas project. Therefore many of the existing Apache Atlas resources (e.g. swagger) is equally relevant for Azure Purview. There is also the official API Swagger documentation available for download - PurviewCatalogAPISwagger.zip.
-
Using Postman once more, create a new HTTP request as per the details below.
- Paste the copied endpoint into the URL (e.g.
https://PURVIEW_ACCOUNT.catalog.purview.azure.com
) - Add the following at the end of the URL to complete the endpoint:
/api/atlas/v2/types/typedefs
Note: Calling this particular endpoint will result in the bulk retrieval of all type definitions. A type definition in Azure Purview is the equivalent of a blueprint and determines how certain objects (e.g. entities, classifications, relationships, etc) need to be created.
Property Value HTTP Method GET
URL https://YOUR_PURVIEW_ACCOUNT.catalog.purview.azure.com/api/atlas/v2/types/typedefs
Navigate to Headers, provide the following key value pair, click Send.
Header Key Header Value Authorization Bearer YOUR_ACCESS_TOKEN
Note: You generated an
access_token
in the previous request. Copy and paste this value. Ensure to include the "Bearer " prefix. - Paste the copied endpoint into the URL (e.g.
-
If successful, Postman should return a JSON document in the body of the response. Click on the magnifying glass and search for the following phrase
"name": "azure_sql_table"
to jump down to the entity definition for an Azure SQL Table.💡 Did you know?
While Azure Purview provides a number of system built type definitions for a variety of object types, Customers can use the API to create their own custom type definitions.
-
The Azure Purview API is largely based on which open source project?
A ) Apache Maven
B ) Apache Spark
C ) Apache Atlas -
The Azure Purview API only works with Python.
A ) True
B ) False -
The Azure Purview API can be used to create custom lineage between data processes and data assets.
A ) True
B ) False
In this module, you learned how to get started with the Azure Purview REST API. To learn more about the Azure Purview REST API, check out the Swagger documentation.