Azure Rest APIs to get the SKU/Tier of Azure Sql Database

Atanu Gupta 141 Reputation points
2023-08-24T12:40:35.03+00:00

Hello,

My problem is that I need to fetch the Tiers and SKU details of Azure Sql Server database via Rest APIs only. I am able to get the same details by running the following powershell script

Get-AzSqlServerServiceObjective -Location eastus

ServiceObjectiveName SkuName       Edition          Family Capacity CapacityUnit Enabled
-------------------- -------       -------          ------ -------- ------------ -------
Free                 Free          Free                    5        DTU          True
Basic                Basic         Basic                   5        DTU          True
S0                   Standard      Standard                10       DTU          True
S1                   Standard      Standard                20       DTU          True
S2                   Standard      Standard                50       DTU          True
S3                   Standard      Standard                100      DTU          True
S4                   Standard      Standard                200      DTU          True
S6                   Standard      Standard                400      DTU          True
S7                   Standard      Standard                800      DTU          True
S9                   Standard      Standard                1600     DTU          True
S12                  Standard      Standard                3000     DTU          True
P1                   Premium       Premium                 125      DTU          True
P2                   Premium       Premium                 250      DTU          True
P4                   Premium       Premium                 500      DTU          True
P6                   Premium       Premium                 1000     DTU          True
P11                  Premium       Premium                 1750     DTU          True
P15                  Premium       Premium     
and lot more

But not able to find any such azure management rest api to get the same information. Is there any such API available or Azure not yet exposing this information via rest? Please advise.

Azure SQL Database
0 comments No comments
{count} votes

Accepted answer
  1. TP 74,876 Reputation points
    2023-08-24T13:03:25.1466667+00:00

    Hi Atanu,

    Below REST API will allow you to list Tier and SKU details for specific location. It is equivalent REST API to the powershell sample code you posted:

    Capabilities - List By Location

    https://learn.microsoft.com/en-us/rest/api/sql/2022-05-01-preview/capabilities/list-by-location?tabs=HTTP

    Please click Accept Answer if the above was useful.

    Thanks.

    -TP

    2 people found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Alberto Morillo 32,806 Reputation points MVP
    2023-08-24T12:48:20.4733333+00:00

    Here you will find how to make a REST API request to get all those properties and more of an Azure SQL Database.

    This is a sample request:

    GET https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb?api-version=2021-02-01-preview
    

    And this is the JSON output it may produce:

    {
      "sku": {
        "name": "BC_Gen5",
        "tier": "BusinessCritical",
        "capacity": 2
      },
      "kind": "v12.0,user,vcore",
      "properties": {
        "collation": "SQL_Latin1_General_CP1_CI_AS",
        "maxSizeBytes": 268435456000,
        "status": "Online",
        "databaseId": "6c764297-577b-470f-9af4-96d3d41e2ba3",
        "creationDate": "2017-06-07T04:41:33.937Z",
        "currentServiceObjectiveName": "BC_Gen5_2",
        "requestedServiceObjectiveName": "BC_Gen5_2",
        "defaultSecondaryLocation": "North Europe",
        "catalogCollation": "SQL_Latin1_General_CP1_CI_AS",
        "licenseType": "LicenseIncluded",
        "maxLogSizeBytes": 104857600,
        "isInfraEncryptionEnabled": false,
        "zoneRedundant": false,
        "readScale": "Enabled",
        "earliestRestoreDate": "2017-06-07T04:51:33.937Z",
        "maintenanceConfigurationId": "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_SouthEastAsia_1",
        "currentSku": {
          "name": "BC_Gen5",
          "tier": "BusinessCritical",
          "capacity": 2
        },
        "currentBackupStorageRedundancy": "Geo",
        "requestedBackupStorageRedundancy": "Geo",
        "isLedgerOn": false
      },
      "location": "southeastasia",
      "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb",
      "name": "testdb",
      "type": "Microsoft.Sql/servers/databases"
    }
    

  2. Rahul Randive 8,181 Reputation points Microsoft Employee
    2023-08-24T12:51:13.65+00:00

    Hi @Atanu Gupta

    Have you tried below Database-Get for individual database.

    https://learn.microsoft.com/en-us/rest/api/sql/2022-02-01-preview/databases/get?tabs=HTTP

    You would get result like below

    User's image

    List of Azure SQL Databases Rest API

    https://learn.microsoft.com/en-us/rest/api/sql/

    Thank you!