Thursday, January 09, 2020

Data Platform Tips 43 - Azure SQL Database REST API

In yesterday's post we looked at how to use Azure Cloud Shell to manage Azure SQL Database and similarly the Azure SQL Database REST API can be used for managing Azure SQL Database resources.

a) First go to https://shell.azure.com

b) Once you have chosen your subscription and logged in, run the commands as shown below to create the Service Principal. This service principal will be used to generate the token which can be used in your REST API calls.












c) Download and install Postman

d) Open Postman App and create a new "POST" Request and provide the details as shown below using the output from b) to generate a token by clicking "Send".

Method: POST
URL: https://login.microsoftonline.com/{{tenantId}}/oauth2/token

  • tenant = tenantId
  • appId = clientId
  • password = clientSecret
  • subscription = [Get it from Azure Portal]









e) The above step will provide the access_token and copy it so that it can be used in subsequent API calls.








f) Create a new request in "GET" request and provide the Authorization token from the previous step and click on "Send"

Method: GET
URL: https://management.azure.com/providers/Microsoft.Sql/operations?api-version=2014-04-01









g) The above endpoint will list all the operations available with the Azure SQL Database REST API and sample response is provided below.










h) You can use any REST API operations similar to above. Here is the list of all API operations that you can try. - https://docs.microsoft.com/en-us/rest/api/sql/




No comments:

Post a Comment