You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d73b901
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/linux/sql-server-linux-sql-assessment-api.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,12 +19,12 @@ The Microsoft's shipped ruleset is available on GitHub. You can view the [entire
19
19
20
20
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:
21
21
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)
23
23
-[SQL Assessment API with PowerShell](#sql-assessment-api-with-powershell)
24
24
25
-
## SQL Assessment extension for Azure Data Studio
25
+
## SQL Assessment extension for Azure Data Studio (preview)
26
26
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.
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
4
8
ms.service: sql
5
9
ms.subservice: tools-other
6
10
ms.topic: conceptual
7
-
author: markingmyname
8
-
ms.author: maghan
9
-
ms.reviewer: ""
10
-
ms.custom: ""
11
-
ms.date: 12/27/2021
12
11
---
13
-
14
12
# SQL Assessment API
15
13
16
14
[!INCLUDE [SQL Server 2012, ASMI, SQL Server on Azure VM, SQL on Linux](../../includes/applies-to-version/sql-asmi-sqlavm-sql-linux.md)]
17
15
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.
19
17
20
18
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.
21
19
22
20
The API can be used to assess:
23
-
24
-
* SQL Server on Azure Virtual Machines
25
21
26
-
* Azure SQL Database Managed Instance
22
+
-SQL Server on Azure Virtual Machines
27
23
28
-
*SQL Server 2012 and higher
24
+
- Azure SQL Managed Instance
29
25
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)
31
29
32
30
The API is also used by SQL Server Assessment Extension for Azure Data Studio (ADS).
33
31
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.
36
34
37
35
## Rules
38
36
@@ -44,122 +42,118 @@ The Microsoft's shipped ruleset is available on GitHub. You can view the [entire
44
42
45
43
### Use the API directly
46
44
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:
48
46
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)
50
48
51
-
Release version as of June 2020 and higher.
49
+
Release version as of June 2020 and higher.
52
50
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)
54
52
55
-
Release version as of July 2019 and higher.
53
+
Release version as of July 2019 and higher.
56
54
57
-
*[SQL Server PowerShell module](../../powershell/download-sql-server-ps-module.md)
55
+
-[SQL Server PowerShell module](../../powershell/download-sql-server-ps-module.md)
58
56
59
-
Release version as of July 2019 and higher.
57
+
Release version as of July 2019 and higher.
60
58
61
59
Before you start using the SQL Assessment API itself, make sure to install either of these:
*[Install via Nuget](https://www.nuget.org/packages/Microsoft.SqlServer.Assessment/)
65
+
-[Install SQL Server PowerShell module](../../powershell/download-sql-server-ps-module.md)
70
66
67
+
-[Install via NuGet](https://www.nuget.org/packages/Microsoft.SqlServer.Assessment/)
71
68
72
69
The SMO Framework is supplemented by the SQL Assessment API extension that provides the following methods:
73
70
74
-
***GetAssessmentItems** – Returns available checks for a particular SQL object (IEnumerable<…>)
71
+
-`GetAssessmentItems`: Returns available checks for a particular SQL object (`IEnumerable<...>`)
75
72
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<...>`)
77
74
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<...>`)
79
76
80
77
### Use the API via PowerShell
81
78
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:
89
80
81
+
-`Get-SqlAssessmentItem`: Provides a list of available assessment checks for a SQL Server object
90
82
83
+
-`Invoke-SqlAssessment`: Provides results of an assessment
91
84
92
85
## Get started using SQL Assessment cmdlets
93
86
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.
95
88
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.
97
90
98
-
Go through the examples below to get started.
91
+
Go through the following examples to get started.
99
92
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.
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.
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.
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.
135
128
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).
137
130
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.
139
132
140
-
## Customizing rules
133
+
## Customize rules
141
134
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.
143
136
144
137
### Options available with rule customization feature
145
138
146
-
#### Enabling/disabling certain rules or groups of rules (using tags)
139
+
#### Enable/disable certain rules or groups of rules (using tags)
147
140
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.
149
142
150
-
#### Changing threshold parameters
143
+
#### Change threshold parameters
151
144
152
145
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.
153
146
154
-
#### Adding more rules written by you or third parties
147
+
#### Add more rules written by you or third parties
155
148
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.
157
150
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.
160
153
161
154
## Next steps
162
155
163
-
* [SQL Server Management Objects (SMO)](../../relational-databases/server-management-objects-smo/overview-smo.md)
0 commit comments