How to access synapse serverless sql pool data using .net REST API

Jaydeep Suryawanshi 26 Reputation points
2024-09-04T06:08:47.28+00:00

Hi Team,

I have created azure cosmos database with analytical store enabled (through azure synapse link).

I am using built in sererless sql pool, I have created couple of views to access the data from analytical store. I want to access these view through using .net REST api.

I followed the answer provided here, but when I am making REST api call I am getting bad(400) request error.

Access Token Request details:

- GET Request URL - https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token
- Body:  
grant_type:client_credentials  
client_id:******  
client_secret:*****  
scope:https://graph.microsoft.com/.default 

Once I get then access token then I am using it next request as below.

POST Request URL : https://{workspace-name}-ondemand.sql.azuresynapse.net/query  
Bearer Auth - Access token  
Body - 
{
    "sql":"SELECT * FROM {ViewName}"
}

Can someone help to get this resolved pls?

Thanks

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
4,858 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.