Skip to main content

database_recommended_actions

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

Overview

Namedatabase_recommended_actions
TypeResource
Idazure.sql.database_recommended_actions

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.
detailsobjectGets additional details specific to this recommended action.
errorDetailsobjectGets the error details if and why this recommended action is put to error state.
estimatedImpactarrayGets the estimated impact info for this recommended action e.g., Estimated CPU gain, Estimated Disk Space change.
executeActionDurationstringGets the time taken for applying this recommended action on user resource. e.g., time taken for index creation.
executeActionInitiatedBystringGets if approval for applying this recommended action was given by user/system. Known values are: "User" and "System". (User, System)
executeActionInitiatedTimestring (date-time)Gets the time when this recommended action was approved for execution.
executeActionStartTimestring (date-time)Gets the time when system started applying this recommended action on the user resource. e.g., index creation start time.
implementationDetailsobjectGets the implementation details of this recommended action for user to apply it manually.
isArchivedActionbooleanGets if this recommended action was suggested some time ago but user chose to ignore this and system added a new recommended action again.
isExecutableActionbooleanGets if this recommended action is actionable by user.
isRevertableActionbooleanGets if changes applied by this recommended action can be reverted by user.
kindstringResource kind.
lastRefreshstring (date-time)Gets time when this recommended action was last refreshed.
linkedObjectsarrayGets the linked objects, if any.
locationstringResource location.
observedImpactarrayGets the observed/actual impact info for this recommended action e.g., Actual CPU gain, Actual Disk Space change.
recommendationReasonstringGets the reason for recommending this action. e.g., DuplicateIndex.
revertActionDurationstringGets the time taken for reverting changes of this recommended action on user resource. e.g., time taken for dropping the created index.
revertActionInitiatedBystringGets if approval for reverting this recommended action was given by user/system. Known values are: "User" and "System". (User, System)
revertActionInitiatedTimestring (date-time)Gets the time when this recommended action was approved for revert.
revertActionStartTimestring (date-time)Gets the time when system started reverting changes of this recommended action on user resource. e.g., time when index drop is executed.
scoreintegerGets the impact of this recommended action. Possible values are 1 - Low impact, 2 - Medium Impact and 3 - High Impact.
stateobjectGets the info of the current state the recommended action is in. Required.
systemDataobjectAzure Resource Manager metadata containing createdBy and modifiedBy information.
timeSeriesarrayGets the time series info of metrics for this recommended action e.g., CPU consumption time series.
typestringThe type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".
validSincestring (date-time)Gets the time since when this recommended action is valid.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresource_group_name, server_name, database_name, advisor_name, recommended_action_name, subscription_idGets a database recommended action.
list_by_database_advisorselectresource_group_name, server_name, database_name, advisor_name, subscription_idGets list of Database Recommended Actions.
updateupdateresource_group_name, server_name, database_name, advisor_name, recommended_action_name, subscription_idUpdates a database recommended action.

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

SELECT examples

Gets a database recommended action.

SELECT
id,
name,
details,
errorDetails,
estimatedImpact,
executeActionDuration,
executeActionInitiatedBy,
executeActionInitiatedTime,
executeActionStartTime,
implementationDetails,
isArchivedAction,
isExecutableAction,
isRevertableAction,
kind,
lastRefresh,
linkedObjects,
location,
observedImpact,
recommendationReason,
revertActionDuration,
revertActionInitiatedBy,
revertActionInitiatedTime,
revertActionStartTime,
score,
state,
systemData,
timeSeries,
type,
validSince
FROM azure.sql.database_recommended_actions
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 recommended_action_name = '{{ recommended_action_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;

UPDATE examples

Updates a database recommended action.

UPDATE azure.sql.database_recommended_actions
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 recommended_action_name = '{{ recommended_action_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
kind,
location,
properties,
systemData,
type;