Watcher
Definition of the watcher type. Uses Azure REST API version 2020-01-13-preview. In version 1.x of the Azure Native provider, it used API version 2019-06-01. Other available API versions: 2023-05-15-preview, 2024-10-23.
Example Usage
Create or update watcher
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var watcher = new AzureNative.Automation.Watcher("watcher", new()
{
AutomationAccountName = "MyTestAutomationAccount",
Description = "This is a test watcher.",
ExecutionFrequencyInSeconds = 60,
ResourceGroupName = "rg",
ScriptName = "MyTestWatcherRunbook",
ScriptRunOn = "MyTestHybridWorkerGroup",
Tags = null,
WatcherName = "MyTestWatcher",
});
});
Content copied to clipboard
package main
import (
automation "github.com/pulumi/pulumi-azure-native-sdk/automation/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := automation.NewWatcher(ctx, "watcher", &automation.WatcherArgs{
AutomationAccountName: pulumi.String("MyTestAutomationAccount"),
Description: pulumi.String("This is a test watcher."),
ExecutionFrequencyInSeconds: pulumi.Float64(60),
ResourceGroupName: pulumi.String("rg"),
ScriptName: pulumi.String("MyTestWatcherRunbook"),
ScriptRunOn: pulumi.String("MyTestHybridWorkerGroup"),
Tags: pulumi.StringMap{},
WatcherName: pulumi.String("MyTestWatcher"),
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.automation.Watcher;
import com.pulumi.azurenative.automation.WatcherArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var watcher = new Watcher("watcher", WatcherArgs.builder()
.automationAccountName("MyTestAutomationAccount")
.description("This is a test watcher.")
.executionFrequencyInSeconds(60)
.resourceGroupName("rg")
.scriptName("MyTestWatcherRunbook")
.scriptRunOn("MyTestHybridWorkerGroup")
.tags()
.watcherName("MyTestWatcher")
.build());
}
}
Content copied to clipboard
Import
An existing resource can be imported using its type token, name, and identifier, e.g.
$ pulumi import azure-native:automation:Watcher MyTestWatcher /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}
Content copied to clipboard
Properties
Link copied to clipboard
Gets or sets the creation time.
Link copied to clipboard
Gets or sets the description.
Link copied to clipboard
Gets or sets the frequency at which the watcher is invoked.
Link copied to clipboard
Details of the user who last modified the watcher.
Link copied to clipboard
Gets or sets the last modified time.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Gets or sets the name of the script the watcher is attached to, i.e. the name of an existing runbook.
Link copied to clipboard
Gets or sets the parameters of the script.
Link copied to clipboard
Gets or sets the name of the hybrid worker group the watcher will run on.