Watcher - Create Or Update

Create the watcher identified by watcher name.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}?api-version=2019-06-01

URI Parameters

Name In Required Type Description
automationAccountName
path True
  • string

The name of the automation account.

resourceGroupName
path True
  • string

Name of an Azure Resource group.

Regex pattern: ^[-\w\._]+$

subscriptionId
path True
  • string

Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.

watcherName
path True
  • string

The watcher name.

api-version
query True
  • string

Client Api Version.

Request Body

Name Type Description
etag
  • string

Gets or sets the etag of the resource.

location
  • string

The geo-location where the resource lives

properties.description
  • string

Gets or sets the description.

properties.executionFrequencyInSeconds
  • integer

Gets or sets the frequency at which the watcher is invoked.

properties.scriptName
  • string

Gets or sets the name of the script the watcher is attached to, i.e. the name of an existing runbook.

properties.scriptParameters
  • object

Gets or sets the parameters of the script.

properties.scriptRunOn
  • string

Gets or sets the name of the hybrid worker group the watcher will run on.

tags
  • object

Resource tags.

Responses

Name Type Description
200 OK

OK

201 Created

Created

Other Status Codes

Automation error response describing why the operation failed.

Security

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

Create or update watcher

Sample Request

PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/MyTestAutomationAccount/watchers/MyTestWatcher?api-version=2019-06-01

{
  "type": null,
  "location": null,
  "tags": {},
  "etag": null,
  "properties": {
    "executionFrequencyInSeconds": 60,
    "scriptName": "MyTestWatcherRunbook",
    "scriptParameters": null,
    "description": "This is a test watcher.",
    "scriptRunOn": "MyTestHybridWorkerGroup",
    "lastModifiedBy": null
  }
}

Sample Response

{
  "id": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/MyTestAutomationAccount/watchers/MyTestWatcher",
  "name": "MyTestWatcher",
  "type": null,
  "location": null,
  "tags": {},
  "etag": null,
  "properties": {
    "executionFrequencyInSeconds": 60,
    "scriptName": "MyTestWatcherRunbook",
    "scriptParameters": null,
    "description": "This is a test watcher.",
    "status": "New",
    "scriptRunOn": "MyTestHybridWorkerGroup",
    "creationTime": "2018-05-14T21:14:09.607+00:00",
    "lastModifiedBy": null,
    "lastModifiedTime": "2018-05-14T21:14:09.607+00:00"
  }
}
{
  "id": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/MyTestAutomationAccount/watchers/MyTestWatcher",
  "name": "MyTestWatcher",
  "type": null,
  "location": null,
  "tags": {},
  "etag": null,
  "properties": {
    "executionFrequencyInSeconds": 60,
    "scriptName": "MyTestWatcherRunbook",
    "scriptParameters": null,
    "description": "This is a test watcher.",
    "status": "New",
    "scriptRunOn": "MyTestHybridWorkerGroup",
    "creationTime": "2018-05-14T21:14:09.607+00:00",
    "lastModifiedBy": null,
    "lastModifiedTime": "2018-05-14T21:14:09.607+00:00"
  }
}

Definitions

ErrorResponse

Error response of an operation failure

Watcher

Definition of the watcher type.

ErrorResponse

Error response of an operation failure

Name Type Description
code
  • string

Error code

message
  • string

Error message indicating why the operation failed.

Watcher

Definition of the watcher type.

Name Type Description
etag
  • string

Gets or sets the etag of the resource.

id
  • string

Fully qualified resource Id for the resource

location
  • string

The geo-location where the resource lives

name
  • string

The name of the resource

properties.creationTime
  • string

Gets or sets the creation time.

properties.description
  • string

Gets or sets the description.

properties.executionFrequencyInSeconds
  • integer

Gets or sets the frequency at which the watcher is invoked.

properties.lastModifiedBy
  • string

Details of the user who last modified the watcher.

properties.lastModifiedTime
  • string

Gets or sets the last modified time.

properties.scriptName
  • string

Gets or sets the name of the script the watcher is attached to, i.e. the name of an existing runbook.

properties.scriptParameters
  • object

Gets or sets the parameters of the script.

properties.scriptRunOn
  • string

Gets or sets the name of the hybrid worker group the watcher will run on.

properties.status
  • string

Gets the current status of the watcher.

tags
  • object

Resource tags.

type
  • string

The type of the resource.