Skip to main content

watcher

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

Overview

Namewatcher
TypeResource
Idazure.automation.watcher

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.
creationTimestring (date-time)Gets or sets the creation time.
descriptionstringGets or sets the description.
etagstringGets or sets the etag of the resource.
executionFrequencyInSecondsintegerGets or sets the frequency at which the watcher is invoked.
lastModifiedBystringDetails of the user who last modified the watcher.
lastModifiedTimestring (date-time)Gets or sets the last modified time.
locationstringThe geo-location where the resource lives.
scriptNamestringGets or sets the name of the script the watcher is attached to, i.e. the name of an existing runbook.
scriptParametersobjectGets or sets the parameters of the script.
scriptRunOnstringGets or sets the name of the hybrid worker group the watcher will run on.
statusstringGets the current status of the watcher.
systemDataobjectAzure Resource Manager metadata containing createdBy and modifiedBy information.
tagsobjectResource tags.
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, automation_account_name, watcher_name, subscription_idRetrieve the watcher identified by watcher name.
list_by_automation_accountselectresource_group_name, automation_account_name, subscription_id$filterRetrieve a list of watchers.
create_or_updateinsertresource_group_name, automation_account_name, watcher_name, subscription_idCreate the watcher identified by watcher name.
updateupdateresource_group_name, automation_account_name, watcher_name, subscription_idUpdate the watcher identified by watcher name.
create_or_updatereplaceresource_group_name, automation_account_name, watcher_name, subscription_idCreate the watcher identified by watcher name.
deletedeleteresource_group_name, automation_account_name, watcher_name, subscription_idDelete the watcher by name.
startexecresource_group_name, automation_account_name, watcher_name, subscription_idResume the watcher identified by watcher name.
stopexecresource_group_name, automation_account_name, watcher_name, subscription_idResume the watcher identified by watcher name.

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
automation_account_namestringThe name of the automation account. Required.
resource_group_namestringThe name of the resource group. The name is case insensitive. Required.
subscription_idstring
watcher_namestringThe watcher name. Required.
$filterstringThe filter to apply on the operation. Default value is None.

SELECT examples

Retrieve the watcher identified by watcher name.

SELECT
id,
name,
creationTime,
description,
etag,
executionFrequencyInSeconds,
lastModifiedBy,
lastModifiedTime,
location,
scriptName,
scriptParameters,
scriptRunOn,
status,
systemData,
tags,
type
FROM azure.automation.watcher
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND automation_account_name = '{{ automation_account_name }}' -- required
AND watcher_name = '{{ watcher_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;

INSERT examples

Create the watcher identified by watcher name.

INSERT INTO azure.automation.watcher (
properties,
etag,
tags,
location,
resource_group_name,
automation_account_name,
watcher_name,
subscription_id
)
SELECT
'{{ properties }}',
'{{ etag }}',
'{{ tags }}',
'{{ location }}',
'{{ resource_group_name }}',
'{{ automation_account_name }}',
'{{ watcher_name }}',
'{{ subscription_id }}'
RETURNING
id,
name,
etag,
location,
properties,
systemData,
tags,
type
;

UPDATE examples

Update the watcher identified by watcher name.

UPDATE azure.automation.watcher
SET
properties = '{{ properties }}',
name = '{{ name }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND automation_account_name = '{{ automation_account_name }}' --required
AND watcher_name = '{{ watcher_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
etag,
location,
properties,
systemData,
tags,
type;

REPLACE examples

Create the watcher identified by watcher name.

REPLACE azure.automation.watcher
SET
properties = '{{ properties }}',
etag = '{{ etag }}',
tags = '{{ tags }}',
location = '{{ location }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND automation_account_name = '{{ automation_account_name }}' --required
AND watcher_name = '{{ watcher_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
etag,
location,
properties,
systemData,
tags,
type;

DELETE examples

Delete the watcher by name.

DELETE FROM azure.automation.watcher
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND automation_account_name = '{{ automation_account_name }}' --required
AND watcher_name = '{{ watcher_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;

Lifecycle Methods

Resume the watcher identified by watcher name.

EXEC azure.automation.watcher.start 
@resource_group_name='{{ resource_group_name }}' --required,
@automation_account_name='{{ automation_account_name }}' --required,
@watcher_name='{{ watcher_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;