List of SQL database with Hybrid pricing

Tom Joyce 61 Reputation points
2021-10-04T17:08:15.827+00:00

I have a lot of SQL databases across multiple subscriptions. I need to list out all the SQL databases that has a column that lets me know if Hybrid pricing is being used or not. It is easy to do with Servers but need to also do the samething for SQL databases so we know what we need to work on to help reduce our costs.

Azure SQL Database
{count} votes

Accepted answer
  1. Ronen Ariely 15,096 Reputation points
    2021-10-07T01:53:19.127+00:00

    Good day Tom,

    List of SQL database with Hybrid pricing

    I assume that you mean databases which are using your local SQL Server licenses with Software Assurance - Azure Hybrid Benefit.

    This is great question, but I think that it is not supported in transact SQL (yet).

    According to the documentation you can select the pricing tier but there is no option to select the license type (Hybrid for example).

    To get the information of the pricing tier for all the databases, you can use sys.database_service_objectives. This view returns the edition but not the information about the license type.

    There is a parameter named LicenseType in the SERVERPROPERTY, but it is always returns DISABLED. Maybe in the future it will work.

    It is a good feedback for the data platform team to add this option using sys.database_service_objectives

    What is the solution?

    In the meantime, you can get the information with PowerShell.

    Execute the command: Get-AzSqlDatabase -ResourceGroupName "your resource name" -ServerName "your server name"

    This will return all the information about all the databases in the server including the parameter LicenseType which is what you are looking for (value BasePrice means Azure Hybrid Benefit) - You can run this on all servers

    0 comments No comments

0 additional answers

Sort by: Most helpful