Things have been a bit busy for me personally over the last few months but that is another story. What I have done is use some of this time to get back to a little project I started a while back.
Introducing the SQL Server Builds API..... providing version information including release dates, and known support life-cycle information.
Overview
The SQL Server Builds API provides SQL Server Version information and known support life-cycle information. As it is a personal project of mine the data is currently manually maintained based on known sources. The main objective of the tool is to enhance health check and project planning type processes, it is not intended for licensing or other legal auditing processes.
In prior roles and particularly in my current role one of the most common checks I perform on a SQL Server is the version and also the patching process. To aid in this what I would do is run reports based off my own custom database of version numbers to check and validate the version of the instance being checked.
Querying the API
To query the API it is pretty simple. The base URI is http://sqlserverbuildsapi.azurewebsites.net/api/SQLVersions
The API takes two parameters
- Version - This is a string representation of the version of your SQL Instance returned by SELECT SERVERPROPERTY('PRODUCTVERSION') e.g. '12.00.2342.00'
- MissingUpdates - A boolean value (True/False) of if to include any updates released since the current patch level in the results
So if I wanted to query for information about the version number 12.00.2342.00 my completed URI would be something like:
http://sqlserverbuildsapi.azurewebsites.net/api/SQLVersions?Version=12.00.2342.00&MissingUpdates=false
NOTE: The MissingUpdates param defaults to false so you could omit it from the URI above.
Where the data comes from
The official source of truth with life-cycle data has to be Microsoft Support Life-cycle (https://support.microsoft.com/lifecycle), and this API/tool is by no means trying to replace that. In fact if you are doing any official auditing for licensing or any other legal means you MUST use that source over this API's data. At least perform your own validation of the data for each record.
Most DBA's and SQL admins would refer to http://sqlserverbuilds.blogspot.com.au. I am no different and I would previously refer to that site as well. So, it is only natural that it is still one of the sources I go to for building my API's database.
The database behind this API is currently manually maintained, and even if it was somewhat automated mistakes can happen. If you find I am missing any updates, or if there is any incorrect data please make sure you reach out and let me know.
Suggestions for using the API
The API could be used in any number of tools and checks. Here are just some I can think of:
- Custom health check scripts
- Enhance on-premise CMDB data
- PowerBI reports
- Other custom Applications that interface/manage SQL Server instances
PowerShell Examples
#1 - Get version information (static version number)
# Set the version number to test $VersionNumber = '12.00.2342.00' # SQL 2014 # Call the API to get the version information $VersionData = Invoke-RestMethod -Uri "http://sqlserverbuildsapi.azurewebsites.net/api/SQLVersions?Version=$($VersionNumber)"; # at this point simply return the $VersionData variable for the raw info $VersionData # Want to improve your Health Check script, calculate the health of Support Status if ($VersionData.ExtendedSupportEnd -le (Get-Date)) {$SupportStatus = 'Critical'} elseif ($VersionData.MainstreamSupportEnd -le (Get-Date)) {$SupportStatus = 'Warning'} else {$SupportStatus = 'Ok'} # format the output data string $OutputData = @" Instance = $($Instance.Name) Version = $($VersionData.Version) Product = $($VersionData.Product) Branch = $($VersionData.Branch) Update = $($VersionData.Update) MainstreamSupportEnd = $($VersionData.MainstreamSupportEnd) ExtendedSupportEnd = $($VersionData.ExtendedSupportEnd) SupportStatus = $($SupportStatus) "@ # Return the hashtable ConvertFrom-StringData -StringData $OutputData;
# Set the version number to test $VersionNumber = '11.00.2342.00' # SQL 2012 # Call the API to get the known missing updates (released since current version) $VersionData = Invoke-RestMethod -Uri "http://sqlserverbuildsapi.azurewebsites.net:80/api/SQLVersions?Version=$($VersionNumber)&MissingUpdates=$true"; # return the output, it is already formated as an Array $VersionData # or as a table $VersionData | Format-Table -Property Version,Branch,Update,@{Name="Released";Expression={Get-Date $_.Released -Format 'yyyy-MM-dd'}},Description -AutoSize
Other Examples
There are more examples in my GitHub repository - https://github.com/Matticusau/SQLServerBuildsAPI-Examples
Including:
- Simple static value examples like above
- Both Single and Multiple Instance examples with live version number data direct from a SQL Instance
- c# Windows Form client
Just want to see it in action, I have an MVC form available at https://sqlserverbuildsportal.azurewebsites.net
Where is the source code for the API
At this time I am not making the API opensource.
Want to partner with me
This is a personal project. If you have a similar project or a project that you would like to use this API in please reach out and lets improve the world together.
If you have any questions around this API please make sure you comment or reach out to me through any of my contact means.
Legal Stuff: The contents of this blog is provided “as-is”. The information, opinions and views expressed are those of the author and do not necessarily state or reflect those of any other company with affiliation to the products discussed. This includes any URLs or Tools. The author does not accept any responsibility from the use of the information or tools mentioned within this blog, and recommends adequate evaluation against your own requirements to measure suitability.