Files
sql-server-samples/samples/manage/sql-assessment-api/notebooks/SQLAssessmentAPIQuickStartNotebook.ipynb
T
Aaron Nelson 9cb55bedea Update SQLAssessmentAPIQuickStartNotebook.ipynb
Moved link to second notebook higher, to make it more obvious how to continue this learning path.
2020-08-20 14:54:55 -04:00

4.8 KiB

SQL Assessment API Quick Start

Assess your SQL Server configuration for best practices in 2 simple steps

1. Setup

You need to install PowerShell SqlServer module using the following command. It is a good practice to run Import-Module at the beginning of your session as well. Get-Module will show you the version you have installed. The minimum version you want is 21.1.18206 — it is the version of SqlServer module containing SQL Assessment API GA.

In [4]:
# Uncomment and run Install-Module only the first time 
# Install-Module -Name SqlServer -AllowClobber -Force
Import-Module -Name SqlServer
Get-Module

2. Invoke an assessment

This command runs an assessment against your local SQL Server instance.

In [5]:
Get-SqlInstance -ServerInstance 'localhost' | Invoke-SqlAssessment

You will see in the results that each rule has some properties (not the full list):

  • Severity (info, warning, critical)
  • Message property explains the recommendation but if you need more info, there is a HelpLink property that points at documentation on the subject.
  • Origin shows which ruleset and version the recommendation is coming from

Visit SQL Assessment API GitHub page at http://aka.ms/sql-assessment-api for a full list of rules and properties.

If you want to get recommendations for all databases on the local instance, you can run this command.

In [6]:
Get-SqlDatabase -ServerInstance 'localhost' | Invoke-SqlAssessment

Learn more about SQL Assessment API

To learn more about SQL Assesment API such as customizing and extending the rule set, saving the results in a table, etc., please visit: