Skip to main content

watchers

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

Overview

Namewatchers
TypeResource
Idazure.db_watcher.watchers

Fields

NameDatatypeDescription
datastoretextfield from the properties object
default_alert_rule_identity_resource_idtextfield from the properties object
identitytextManaged service identity (system assigned and/or user assigned identities)
locationtextThe geo-location where the resource lives
provisioning_statetextfield from the properties object
resourceGroupNametextfield from the properties object
statustextfield from the properties object
subscriptionIdtextfield from the properties object
tagstextResource tags.
watcherNametextfield from the properties object

Methods

NameAccessible byRequired ParamsDescription
getSELECTresourceGroupName, subscriptionId, watcherNameGet a Watcher
list_by_resource_groupSELECTresourceGroupName, subscriptionIdList Watcher resources by resource group
list_by_subscriptionSELECTsubscriptionIdList Watcher resources by subscription ID
create_or_updateINSERTresourceGroupName, subscriptionId, watcherNameCreate a Watcher
deleteDELETEresourceGroupName, subscriptionId, watcherNameDelete a Watcher
updateUPDATEresourceGroupName, subscriptionId, watcherNameUpdate a Watcher
startEXECresourceGroupName, subscriptionId, watcherNameThe action to start monitoring all targets configured for a database watcher.
stopEXECresourceGroupName, subscriptionId, watcherNameThe action to stop monitoring all targets configured for a database watcher.

SELECT examples

List Watcher resources by subscription ID

SELECT
datastore,
default_alert_rule_identity_resource_id,
identity,
location,
provisioning_state,
resourceGroupName,
status,
subscriptionId,
tags,
watcherName
FROM azure.db_watcher.vw_watchers
WHERE subscriptionId = '{{ subscriptionId }}';

INSERT example

Use the following StackQL query and manifest file to create a new watchers resource.

/*+ create */
INSERT INTO azure.db_watcher.watchers (
resourceGroupName,
subscriptionId,
watcherName,
properties,
identity,
tags,
location
)
SELECT
'{{ resourceGroupName }}',
'{{ subscriptionId }}',
'{{ watcherName }}',
'{{ properties }}',
'{{ identity }}',
'{{ tags }}',
'{{ location }}'
;

UPDATE example

Updates a watchers resource.

/*+ update */
UPDATE azure.db_watcher.watchers
SET
identity = '{{ identity }}',
tags = '{{ tags }}',
properties = '{{ properties }}'
WHERE
resourceGroupName = '{{ resourceGroupName }}'
AND subscriptionId = '{{ subscriptionId }}'
AND watcherName = '{{ watcherName }}';

DELETE example

Deletes the specified watchers resource.

/*+ delete */
DELETE FROM azure.db_watcher.watchers
WHERE resourceGroupName = '{{ resourceGroupName }}'
AND subscriptionId = '{{ subscriptionId }}'
AND watcherName = '{{ watcherName }}';