mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
2.4 KiB
2.4 KiB
attr::service:: variables
Automatic variables in the *attr::service:: namespace are provided with Service requirements.
The following variables are available for each service. Service key is a value from Service requirement supported values.
| Variable name | Type | Description |
|---|---|---|
| attr::service::key | bool | Inidicates if the service is present |
| attr::service::key.name | string | Actual service name |
| attr::service::key.account | string | User account name for this service |
Examples
In the following example the message will report actual user account name when the SQL Server Agent service is present and running under local service account. See Message template.
{
…
"message": "Account '@{attr::service::SQLAgent.account}' is not supported for 'SQL Server Agent' service.",
"localServiceAccount": "NT AUTHORITY\\LOCALSERVICE",
"condition": [
{ "not": "@attr::service::SQLAgent" },
{ "ine": [
"@attr::service::SQLAgent.account",
"@localServiceAccount"
]}
],
"probes": [ "IsClusteredServer" ]
}
The next example extends the previous check with support for clustered servers. When the server is clustered, three more accounts are not supported.
{
…
"message": "Account '@{attr::service::SQLAgent.account}' is not supported for 'SQL Server Agent' service.",
"localServiceAccount": "NT AUTHORITY\\LOCALSERVICE",
"unsupportedAccounts": [
"NT AUTHORITY\\SYSTEM",
"LOCALSYSTEM",
"NT AUTHORITY\\NETWORKSERVICE"
],
"condition": [
{ "not": "@attr::service::SQLAgent" },
{
"ine": [
"@attr::service::SQLAgent.account",
"@localServiceAccount"
],
"or": [
{ "not": "@is_clustered_server" },
{ "not": {
"iin": [
"@attr::service::SQLAgent.account",
"@unsupportedAccounts"
]
}}
]
}
],
"probes": [ "IsClusteredServer" ]
}