Skip to content

Commit d73b901

Browse files
amitkh-msftrwestMSFT
authored andcommitted
Update sql-assessment-api-overview.md
adding a link to the SQL Server on Linux page to help guide customers to run the assessment api for SQL on Linux.
1 parent b222cae commit d73b901

2 files changed

Lines changed: 75 additions & 81 deletions

File tree

‎docs/linux/sql-server-linux-sql-assessment-api.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ The Microsoft's shipped ruleset is available on GitHub. You can view the [entire
1919

2020
In this article, we look at two ways to run the SQL Assessment API for [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)] on Linux and containers:
2121

22-
- [SQL Assessment extension for Azure Data Studio](#sql-assessment-extension-for-azure-data-studio)
22+
- [SQL Assessment extension for Azure Data Studio](#sql-assessment-extension-for-azure-data-studio-preview) (Preview)
2323
- [SQL Assessment API with PowerShell](#sql-assessment-api-with-powershell)
2424

25-
## SQL Assessment extension for Azure Data Studio
25+
## SQL Assessment extension for Azure Data Studio (preview)
2626

27-
The SQL Assessment extension for Azure Data Studio provides a mechanism to evaluate the configuration of [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)] for best practices.
27+
The SQL Assessment extension for Azure Data Studio (preview) provides a mechanism to evaluate the configuration of [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)] for best practices.
2828

2929
With this preview version, you can:
3030

Lines changed: 72 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,36 @@
11
---
22
title: SQL Server Assessment API
33
description: Learn about the SQL Assessment API that provides a mechanism to evaluate the configuration of your SQL Server for best practices.
4+
author: markingmyname
5+
ms.author: maghan
6+
ms.reviewer: randolphwest
7+
ms.date: 01/18/2023
48
ms.service: sql
59
ms.subservice: tools-other
610
ms.topic: conceptual
7-
author: markingmyname
8-
ms.author: maghan
9-
ms.reviewer: ""
10-
ms.custom: ""
11-
ms.date: 12/27/2021
1211
---
13-
1412
# SQL Assessment API
1513

1614
[!INCLUDE [SQL Server 2012, ASMI, SQL Server on Azure VM, SQL on Linux](../../includes/applies-to-version/sql-asmi-sqlavm-sql-linux.md)]
1715

18-
The SQL Assessment API provides a mechanism to evaluate the configuration of your SQL Server for best practices. The API is delivered with a ruleset containing best practice rules suggested by SQL Server Team. This ruleset is enhanced with the release of new versions, but at the same time, the API is built with the intent to give a highly customizable and extensible solution. So, users can tune the default rules and create their own.
16+
The SQL Assessment API provides a mechanism to evaluate the configuration of your SQL Server for best practices. The API is delivered with a ruleset containing best practice rules suggested by the SQL Server team. This ruleset is enhanced with the release of new versions, but at the same time, the API is built to give a highly customizable and extensible solution. Users can tune the default rules and create their own.
1917

2018
The SQL Assessment API is useful when you want to make sure your SQL Server configuration is in line with recommended best practices. After an initial assessment, configuration stability can be tracked by regularly scheduled assessments.
2119

2220
The API can be used to assess:
23-
24-
* SQL Server on Azure Virtual Machines
2521

26-
* Azure SQL Database Managed Instance
22+
- SQL Server on Azure Virtual Machines
2723

28-
* SQL Server 2012 and higher
24+
- Azure SQL Managed Instance
2925

30-
* SQL on Linux-based systems
26+
- SQL Server 2012 and higher
27+
28+
- SQL Server on [Linux-based systems and containers](../../linux/sql-server-linux-sql-assessment-api.md)
3129

3230
The API is also used by SQL Server Assessment Extension for Azure Data Studio (ADS).
3331

34-
>[!NOTE]
35-
>The SQL Assessment API provides assessment on a variety of areas, but it does not go deeply into security. We recommend you use [SQL Vulnerability Assessment](../../relational-databases/security/sql-vulnerability-assessment.md) to proactively improve your database security.
32+
> [!NOTE]
33+
> The SQL Assessment API provides assessment on a variety of areas, but it does not go deeply into security. We recommend you use [SQL Vulnerability Assessment](../../relational-databases/security/sql-vulnerability-assessment.md) to proactively improve your database security.
3634
3735
## Rules
3836

@@ -44,122 +42,118 @@ The Microsoft's shipped ruleset is available on GitHub. You can view the [entire
4442

4543
### Use the API directly
4644

47-
The SQL Assessment API is available and can be used through managed code as part of any of these components :
45+
The SQL Assessment API is available and can be used through managed code as part of any of these components:
4846

49-
* [Azure Data Studio (ADS)](../../azure-data-studio/what-is-azure-data-studio.md)
47+
- [Azure Data Studio (ADS)](../../azure-data-studio/what-is-azure-data-studio.md)
5048

51-
Release version as of June 2020 and higher.
49+
Release version as of June 2020 and higher.
5250

53-
* [SQL Server Management Objects (SMO)](../../relational-databases/server-management-objects-smo/installing-smo.md)
51+
- [SQL Server Management Objects (SMO)](../../relational-databases/server-management-objects-smo/installing-smo.md)
5452

55-
Release version as of July 2019 and higher.
53+
Release version as of July 2019 and higher.
5654

57-
* [SQL Server PowerShell module](../../powershell/download-sql-server-ps-module.md)
55+
- [SQL Server PowerShell module](../../powershell/download-sql-server-ps-module.md)
5856

59-
Release version as of July 2019 and higher.
57+
Release version as of July 2019 and higher.
6058

6159
Before you start using the SQL Assessment API itself, make sure to install either of these:
6260

63-
* [Install ADS](https://techcommunity.microsoft.com/t5/sql-server/released-sql-server-assessment-extension-for-azure-data-studio/ba-p/1470603)
64-
65-
* [Install SMO](../../relational-databases/server-management-objects-smo/installing-smo.md)
61+
- [Install ADS](https://techcommunity.microsoft.com/t5/sql-server/released-sql-server-assessment-extension-for-azure-data-studio/ba-p/1470603)
6662

67-
* [Install SQL Server PowerShell module](../../powershell/download-sql-server-ps-module.md)
63+
- [Install SMO](../../relational-databases/server-management-objects-smo/installing-smo.md)
6864

69-
* [Install via Nuget](https://www.nuget.org/packages/Microsoft.SqlServer.Assessment/)
65+
- [Install SQL Server PowerShell module](../../powershell/download-sql-server-ps-module.md)
7066

67+
- [Install via NuGet](https://www.nuget.org/packages/Microsoft.SqlServer.Assessment/)
7168

7269
The SMO Framework is supplemented by the SQL Assessment API extension that provides the following methods:
7370

74-
* **GetAssessmentItems** – Returns available checks for a particular SQL object (IEnumerable<…>)
71+
- `GetAssessmentItems`: Returns available checks for a particular SQL object (`IEnumerable<...>`)
7572

76-
* **GetAssessmentResults** – Synchronously evaluates assessment and returns results and errors if any (IEnumerable<…>)
73+
- `GetAssessmentResults`: Synchronously evaluates assessment and returns results and errors if any (`IEnumerable<...>`)
7774

78-
* **GetAssessmentResultsList** – Asynchronously evaluates assessment and returns results and errors if any (Task<…>)
75+
- `GetAssessmentResultsList`: Asynchronously evaluates assessment and returns results and errors if any (`Task<...>`)
7976

8077
### Use the API via PowerShell
8178

82-
If you would like to invoke the SQL Assessment API via PowerShell, you must [install SQL Server PowerShell module](../../powershell/download-sql-server-ps-module.md)
83-
84-
The SqlServer module is getting two new cmdlets to work with SQL Assessment API:
85-
86-
* **Get-SqlAssessmentItem** – Provides a list of available assessment checks for a SQL Server object
87-
88-
* **Invoke-SqlAssessment** – Provides results of an assessment
79+
If you would like to invoke the SQL Assessment API via PowerShell, you must [install SQL Server PowerShell module](../../powershell/download-sql-server-ps-module.md). The `SqlServer` module provides two cmdlets that work with the SQL Assessment API:
8980

81+
- `Get-SqlAssessmentItem`: Provides a list of available assessment checks for a SQL Server object
9082

83+
- `Invoke-SqlAssessment`: Provides results of an assessment
9184

9285
## Get started using SQL Assessment cmdlets
9386

94-
An assessment is performed against a chosen SQL Server object. In the default ruleset, there are checks for two kinds of objects only: Server and Database (in addition to them, the API supports two more kinds: Filegroup and AvailabilityGroup). If you want to assess a SQL instance and all its databases, you should run the SQL Assessment cmdlets for each object separately. Or you can pass objects for assessment to the SQL Assessment cmdlets in a variable or the pipeline.
87+
An assessment is performed against a chosen SQL Server object. In the default ruleset, there are checks for two kinds of objects only: `Server` and `Database` (in addition to them, the API supports two more kinds: `Filegroup` and `AvailabilityGroup`). If you want to assess a SQL Server instance and all its databases, you should run the SQL Assessment cmdlets for each object separately. Or, you can pass objects for assessment to the SQL Assessment cmdlets in a variable or the pipeline.
9588

96-
SqlServer and RegisteredServer objects are interchangeable, so you can pass any to the SQL Assessment cmdlets.
89+
`SqlServer` and `RegisteredServer` objects are interchangeable, so you can pass any to the SQL Assessment cmdlets.
9790

98-
Go through the examples below to get started.
91+
Go through the following examples to get started.
9992

100-
1. Get a list of available checks for a local default instance to familiarize yourself with the checks. In this example, we're piping the output of the Get-SqlInstance cmdlet to the Get-SqlAssessmentItem cmdlet to pass the instance object to it.
93+
1. Get a list of available checks for a local default instance to familiarize yourself with the checks. In this example, we're piping the output of the `Get-SqlInstance` cmdlet to the `Get-SqlAssessmentItem` cmdlet to pass the instance object to it.
10194

102-
```powershell
103-
Get-SqlInstance -ServerInstance 'localhost' | Get-SqlAssessmentItem
104-
```
95+
```powershell
96+
Get-SqlInstance -ServerInstance 'localhost' | Get-SqlAssessmentItem
97+
```
10598

106-
2. Get a list of available checks for all databases of the instance. Here, we're using the Get-Item cmdlet and a path implemented with the Windows PowerShell SQL Server provider to get a list of the databases, and then piping it to the Get-SqlDatabase cmdlet.
99+
1. Get a list of available checks for all databases of the instance. Here, we're using the `Get-Item` cmdlet and a path implemented with the Windows PowerShell SQL Server provider to get a list of the databases, and then piping it to the `Get-SqlDatabase` cmdlet.
107100

108-
```powershell
109-
Get-Item SQLSERVER:\SQL\localhost\default | Get-SqlAssessmentItem
110-
```
101+
```powershell
102+
Get-Item SQLSERVER:\SQL\localhost\default | Get-SqlAssessmentItem
103+
```
111104

112-
Also, you can use the Get-SqlDatabase cmdlet to do the same.
105+
Also, you can use the `Get-SqlDatabase` cmdlet to do the same.
113106

114-
```powershell
115-
Get-SqlDatabase -ServerInstance 'localhost' | Get-SqlAssessmentItem
116-
```
107+
```powershell
108+
Get-SqlDatabase -ServerInstance 'localhost' | Get-SqlAssessmentItem
109+
```
117110

118-
3. Invoke assessment for the instance and save the results to a SQL table. In this example, we're piping the output of the Get-SqlInstance cmdlet to the Invoke-SqlAssessment cmdlet, which results are piped to the Write-SqlTableData cmdlet. The Invoke-Assessment cmdlet is run with the `-FlattenOutput` parameter in this example. This parameter makes the output suitable for the Write-SqlTableData cmdlet. The latter raises an error if you omit the parameter.
111+
1. Invoke assessment for the instance and save the results to a SQL Server table. In this example, we're piping the output of the `Get-SqlInstance` cmdlet to the `Invoke-SqlAssessment` cmdlet, which results are piped to the `Write-SqlTableData` cmdlet. The `Invoke-Assessment` cmdlet is run with the `-FlattenOutput` parameter in this example. This parameter makes the output suitable for the `Write-SqlTableData` cmdlet. The latter raises an error if you omit the parameter.
119112

120-
```powershell
121-
Get-SqlInstance -ServerInstance 'localhost' |
122-
Invoke-SqlAssessment -FlattenOutput |
123-
Write-SqlTableData -ServerInstance 'localhost' -DatabaseName SQLAssessmentDemo -SchemaName Assessment -TableName Results -Force
124-
```
113+
```powershell
114+
Get-SqlInstance -ServerInstance 'localhost' |
115+
Invoke-SqlAssessment -FlattenOutput |
116+
Write-SqlTableData -ServerInstance 'localhost' -DatabaseName SQLAssessmentDemo -SchemaName Assessment -TableName Results -Force
117+
```
125118

126-
Now let's invoke an assessment for all databases of the instance and add the results to the same table.
119+
Now let's invoke an assessment for all databases of the instance and add the results to the same table.
127120

128-
```powershell
129-
Get-SqlDatabase -ServerInstance 'localhost' |
130-
Invoke-SqlAssessment -FlattenOutput |
131-
Write-SqlTableData -ServerInstance 'localhost' -DatabaseName SQLAssessmentDemo -SchemaName Assessment -TableName Results -Force
132-
```
121+
```powershell
122+
Get-SqlDatabase -ServerInstance 'localhost' |
123+
Invoke-SqlAssessment -FlattenOutput |
124+
Write-SqlTableData -ServerInstance 'localhost' -DatabaseName SQLAssessmentDemo -SchemaName Assessment -TableName Results -Force
125+
```
133126

134-
4. Follow descriptions and links in the table to further understand the recommendations.
127+
1. Follow descriptions and links in the table to further understand the recommendations.
135128

136-
5. Customize the rules based on your environment and organizational requirements (see below).
129+
1. Customize the rules based on your environment and organizational requirements (see below).
137130

138-
6. Schedule a task or a job to run the assessment regularly or on-demand to measure progress.
131+
1. Schedule a task or a job to run the assessment regularly or on-demand to measure progress.
139132

140-
## Customizing rules
133+
## Customize rules
141134

142-
Rules are designed to be customizable and extensible. Microsoft's ruleset is designed to work for most environments. However, it's impossible to have one ruleset that works for every single environment. Users can write their own JSON files and customize existing rules or add new ones. Examples of customization and complete Microsoft released ruleset are available in the [samples repository](https://aka.ms/sql-assessment-api). For more details on how to run the SQL Assessment cmdlets with custom JSON files, use the Get-Help cmdlet.
135+
Rules are designed to be customizable and extensible. Microsoft's ruleset is designed to work for most environments. However, it's impossible to have one ruleset that works for every single environment. Users can write their own JSON files and customize existing rules or add new ones. Examples of customization and complete Microsoft released ruleset are available in the [samples repository](https://aka.ms/sql-assessment-api). For more details on how to run the SQL Assessment cmdlets with custom JSON files, use the `Get-Help` cmdlet.
143136

144137
### Options available with rule customization feature
145138

146-
#### Enabling/disabling certain rules or groups of rules (using tags)
139+
#### Enable/disable certain rules or groups of rules (using tags)
147140

148-
You can silence specific rules when they aren't applied to your environment or until scheduled work is done to rectify the issue.
141+
You can silence specific rules when they aren't applied to your environment, or until scheduled work is done to rectify the issue.
149142

150-
#### Changing threshold parameters
143+
#### Change threshold parameters
151144

152145
Specific rules have thresholds that are compared against the current value of a metric to find out an issue. If the default thresholds don't fit, you can change them.
153146

154-
#### Adding more rules written by you or third parties
147+
#### Add more rules written by you or third parties
155148

156-
You can string together rulesets by adding one or more JSON files as parameters to your SQL Assessment API call. Your organization might write those files or obtain them from a third party. For example, you can have your JSON file that disables specific rules from the Microsoft ruleset, and another JSON file by an industry expert that include rules you find useful for your environment, followed by another JSON file that changes some threshold values in that JSON file.
149+
You can combine rulesets by adding one or more JSON files as parameters to your SQL Assessment API call. Your organization might write those files or obtain them from a third party. For example, you can have your JSON file that disables specific rules from the Microsoft ruleset, and another JSON file by an industry expert that include rules you find useful for your environment, followed by another JSON file that changes some threshold values in that JSON file.
157150

158-
>[!IMPORTANT]
159-
>We urge you not to use rulesets that come from untrusted sources until you thoroughly review them to make sure they are safe.
151+
> [!IMPORTANT]
152+
> We urge you not to use rulesets that come from untrusted sources, until you thoroughly review them to make sure they are safe.
160153
161154
## Next steps
162155

163-
* [SQL Server Management Objects (SMO)](../../relational-databases/server-management-objects-smo/overview-smo.md)
164-
* [PowerShell](../../powershell/download-sql-server-ps-module.md)
165-
* [SQL Vulnerability Assessment](../../relational-databases/security/sql-vulnerability-assessment.md)
156+
- [SQL Server Management Objects (SMO)](../../relational-databases/server-management-objects-smo/overview-smo.md)
157+
- [PowerShell](../../powershell/download-sql-server-ps-module.md)
158+
- [SQL Vulnerability Assessment](../../relational-databases/security/sql-vulnerability-assessment.md)
159+
- [Use SQL Assessment API for SQL Server on Linux](../../linux/sql-server-linux-sql-assessment-api.md)

0 commit comments

Comments
 (0)