Skip to main content

database_advisors

Creates, updates, deletes, gets or lists a database_advisors resource.

Overview

Namedatabase_advisors
TypeResource
Idazure.sql.database_advisors

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringFully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
namestringThe name of the resource.
advisorStatusstringGets the status of availability of this advisor to customers. Possible values are 'GA', 'PublicPreview', 'LimitedPublicPreview' and 'PrivatePreview'. Known values are: "GA", "PublicPreview", "LimitedPublicPreview", and "PrivatePreview". (GA, PublicPreview, LimitedPublicPreview, PrivatePreview)
autoExecuteStatusstringGets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Required. Known values are: "Enabled", "Disabled", and "Default". (Enabled, Disabled, Default)
autoExecuteStatusInheritedFromstringGets the resource from which current value of auto-execute status is inherited. Auto-execute status can be set on (and inherited from) different levels in the resource hierarchy. Possible values are 'Subscription', 'Server', 'ElasticPool', 'Database' and 'Default' (when status is not explicitly set on any level). Known values are: "Default", "Subscription", "Server", "ElasticPool", and "Database". (Default, Subscription, Server, ElasticPool, Database)
kindstringResource kind.
lastCheckedstring (date-time)Gets the time when the current resource was analyzed for recommendations by this advisor.
locationstringResource location.
recommendationsStatusstringGets that status of recommendations for this advisor and reason for not having any recommendations. Possible values include, but are not limited to, 'Ok' (Recommendations available),LowActivity (not enough workload to analyze), 'DbSeemsTuned' (Database is doing well), etc.
recommendedActionsarrayGets the recommended actions for this advisor.
systemDataobjectAzure Resource Manager metadata containing createdBy and modifiedBy information.
typestringThe type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresource_group_name, server_name, database_name, advisor_name, subscription_idGets a database advisor.
list_by_databaseselectresource_group_name, server_name, database_name, subscription_id$expandGets a list of database advisors.
updateupdateresource_group_name, server_name, database_name, advisor_name, subscription_idUpdates a database advisor.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
advisor_namestringThe name of the Database Advisor. Required.
database_namestringThe name of the database. Required.
resource_group_namestringThe name of the resource group. The name is case insensitive. Required.
server_namestringThe name of the server. Required.
subscription_idstring
$expandstringThe child resources to include in the response. Default value is None.

SELECT examples

Gets a database advisor.

SELECT
id,
name,
advisorStatus,
autoExecuteStatus,
autoExecuteStatusInheritedFrom,
kind,
lastChecked,
location,
recommendationsStatus,
recommendedActions,
systemData,
type
FROM azure.sql.database_advisors
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND server_name = '{{ server_name }}' -- required
AND database_name = '{{ database_name }}' -- required
AND advisor_name = '{{ advisor_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;

UPDATE examples

Updates a database advisor.

UPDATE azure.sql.database_advisors
SET
properties = '{{ properties }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND server_name = '{{ server_name }}' --required
AND database_name = '{{ database_name }}' --required
AND advisor_name = '{{ advisor_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
kind,
location,
properties,
systemData,
type;