watcher
Creates, updates, deletes, gets or lists a watcher resource.
Overview
| Name | watcher |
| Type | Resource |
| Id | azure.automation.watcher |
Fields
The following fields are returned by SELECT queries:
- get
- list_by_automation_account
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
creationTime | string (date-time) | Gets or sets the creation time. |
description | string | Gets or sets the description. |
etag | string | Gets or sets the etag of the resource. |
executionFrequencyInSeconds | integer | Gets or sets the frequency at which the watcher is invoked. |
lastModifiedBy | string | Details of the user who last modified the watcher. |
lastModifiedTime | string (date-time) | Gets or sets the last modified time. |
location | string | The geo-location where the resource lives. |
scriptName | string | Gets or sets the name of the script the watcher is attached to, i.e. the name of an existing runbook. |
scriptParameters | object | Gets or sets the parameters of the script. |
scriptRunOn | string | Gets or sets the name of the hybrid worker group the watcher will run on. |
status | string | Gets the current status of the watcher. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
tags | object | Resource tags. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
creationTime | string (date-time) | Gets or sets the creation time. |
description | string | Gets or sets the description. |
etag | string | Gets or sets the etag of the resource. |
executionFrequencyInSeconds | integer | Gets or sets the frequency at which the watcher is invoked. |
lastModifiedBy | string | Details of the user who last modified the watcher. |
lastModifiedTime | string (date-time) | Gets or sets the last modified time. |
location | string | The geo-location where the resource lives. |
scriptName | string | Gets or sets the name of the script the watcher is attached to, i.e. the name of an existing runbook. |
scriptParameters | object | Gets or sets the parameters of the script. |
scriptRunOn | string | Gets or sets the name of the hybrid worker group the watcher will run on. |
status | string | Gets the current status of the watcher. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
tags | object | Resource tags. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
Methods
The following methods are available for this resource:
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.
| Name | Datatype | Description |
|---|---|---|
automation_account_name | string | The name of the automation account. Required. |
resource_group_name | string | The name of the resource group. The name is case insensitive. Required. |
subscription_id | string | |
watcher_name | string | The watcher name. Required. |
$filter | string | The filter to apply on the operation. Default value is None. |
SELECT examples
- get
- list_by_automation_account
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
;
Retrieve a list of watchers.
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 subscription_id = '{{ subscription_id }}' -- required
AND $filter = '{{ $filter }}'
;
INSERT examples
- create_or_update
- Manifest
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
;
# Description fields are for documentation purposes
- name: watcher
props:
- name: resource_group_name
value: "{{ resource_group_name }}"
description: Required parameter for the watcher resource.
- name: automation_account_name
value: "{{ automation_account_name }}"
description: Required parameter for the watcher resource.
- name: watcher_name
value: "{{ watcher_name }}"
description: Required parameter for the watcher resource.
- name: subscription_id
value: "{{ subscription_id }}"
description: Required parameter for the watcher resource.
- name: properties
description: |
Gets or sets the watcher properties.
value:
executionFrequencyInSeconds: {{ executionFrequencyInSeconds }}
scriptName: "{{ scriptName }}"
scriptParameters: "{{ scriptParameters }}"
scriptRunOn: "{{ scriptRunOn }}"
status: "{{ status }}"
creationTime: "{{ creationTime }}"
lastModifiedTime: "{{ lastModifiedTime }}"
lastModifiedBy: "{{ lastModifiedBy }}"
description: "{{ description }}"
- name: etag
value: "{{ etag }}"
description: |
Gets or sets the etag of the resource.
- name: tags
value: "{{ tags }}"
description: |
Resource tags.
- name: location
value: "{{ location }}"
description: |
The geo-location where the resource lives.
UPDATE examples
- update
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_or_update
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
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
- start
- stop
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
;
Resume the watcher identified by watcher name.
EXEC azure.automation.watcher.stop
@resource_group_name='{{ resource_group_name }}' --required,
@automation_account_name='{{ automation_account_name }}' --required,
@watcher_name='{{ watcher_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;