Author: Abid Nazir Guroo is a Program Manager in Azure Synapse Customer Success Engineering (CSE) team.
Azure Synapse Analytics Representational State Transfer (REST) APIs are secure HTTP service endpoints that support creating and managing Azure Synapse resources using Azure Resource Manager and Azure Synapse web endpoints. This article provides instructions on how to setup and use Synapse REST endpoints and describe the Apache Spark Pool operations supported by REST APIs.
In order to perform any operation using Azure REST APIs you need to authenticate the request using an azure active directory authentication token. This token can be generated by various interactive and non-interactive methods. In this tutorial we will use a azure active directory service principal for generating a token with below steps:
Create a secret for the registered service principal and save it securely for usage. Instructions for creating a secret are documented at - Create a secret for an application
Assign an appropriate role to the registered service principal on the Synapse Workspace based on the operations you want to perform using the REST APIs. You can find detailed information on all available Azure Synapse Analytics roles and corresponding permissions at - Azure Synapse RBAC roles
REST API Client
You can use various command line utilities like CURL or Powershell, programming languages or GUI clients to interact with REST API endpoints. In this article we will leverage a widely used GUI application - Postman for its simplicity and ease of setup. Postman can be downloaded with this link.
Example: How to get an Azure AD Access Token
The following parameters are needed to successfully get an Azure AD access token:
The Azure Active Directory (tenant) ID where the application is registered.
The Application (client) ID for the application registered in Azure AD.
The Value of the client secret for the application registered in Azure AD.
On the Postman UI
Create a new HTTP request (File > New > HTTP Request or using the new tab (+) icon).
Detailed documentation of all the REST API operations supported overall by Azure Synapse Analytics can be found with this link.
Example: How to invoke an Apache Spark REST endpoint to create or update a spark pool
The Create Or Update REST API can be used to create a new Apache Spark Pool or change configurations of an existing pool, including the ability to upgrade/downgrade the Spark runtime version of a pool. For example, an existing Apache Spark pool with spark runtime version 3.1 can be upgraded to Spark version 3.2 without the need of deletion of the existing pool.
On the Postman UI
Create a new HTTP request (File > New > HTTP Request or using the new tab(+) icon).
Azure Synapse Analytics REST APIs REST APIs can be used for operation of various Synapse services. The REST APIs can be used to upgrade/downgrade Spark runtime version, auto-scale configuration, library management and more.