Runbook
Definition of the runbook type. Uses Azure REST API version 2023-11-01. In version 2.x of the Azure Native provider, it used API version 2022-08-08. Other available API versions: 2015-10-31, 2018-06-30, 2019-06-01, 2022-08-08, 2023-05-15-preview, 2024-10-23. These can be accessed by generating a local SDK package using the CLI command pulumi package add azure-native automation [ApiVersion]
. See the ../../../version-guide/#accessing-any-api-version-via-local-packages for details.
Example Usage
Create or update runbook and publish it
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var runbook = new AzureNative.Automation.Runbook("runbook", new()
{
AutomationAccountName = "ContoseAutomationAccount",
Description = "Description of the Runbook",
Location = "East US 2",
LogActivityTrace = 1,
LogProgress = true,
LogVerbose = false,
Name = "Get-AzureVMTutorial",
PublishContentLink = new AzureNative.Automation.Inputs.ContentLinkArgs
{
ContentHash = new AzureNative.Automation.Inputs.ContentHashArgs
{
Algorithm = "SHA256",
Value = "115775B8FF2BE672D8A946BD0B489918C724DDE15A440373CA54461D53010A80",
},
Uri = "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-automation-runbook-getvms/Runbooks/Get-AzureVMTutorial.ps1",
},
ResourceGroupName = "rg",
RunbookName = "Get-AzureVMTutorial",
RunbookType = AzureNative.Automation.RunbookTypeEnum.PowerShellWorkflow,
Tags =
{
{ "tag01", "value01" },
{ "tag02", "value02" },
},
});
});
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.NewRunbook(ctx, "runbook", &automation.RunbookArgs{
AutomationAccountName: pulumi.String("ContoseAutomationAccount"),
Description: pulumi.String("Description of the Runbook"),
Location: pulumi.String("East US 2"),
LogActivityTrace: pulumi.Int(1),
LogProgress: pulumi.Bool(true),
LogVerbose: pulumi.Bool(false),
Name: pulumi.String("Get-AzureVMTutorial"),
PublishContentLink: &automation.ContentLinkArgs{
ContentHash: &automation.ContentHashArgs{
Algorithm: pulumi.String("SHA256"),
Value: pulumi.String("115775B8FF2BE672D8A946BD0B489918C724DDE15A440373CA54461D53010A80"),
},
Uri: pulumi.String("https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-automation-runbook-getvms/Runbooks/Get-AzureVMTutorial.ps1"),
},
ResourceGroupName: pulumi.String("rg"),
RunbookName: pulumi.String("Get-AzureVMTutorial"),
RunbookType: pulumi.String(automation.RunbookTypeEnumPowerShellWorkflow),
Tags: pulumi.StringMap{
"tag01": pulumi.String("value01"),
"tag02": pulumi.String("value02"),
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.automation.Runbook;
import com.pulumi.azurenative.automation.RunbookArgs;
import com.pulumi.azurenative.automation.inputs.ContentLinkArgs;
import com.pulumi.azurenative.automation.inputs.ContentHashArgs;
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 runbook = new Runbook("runbook", RunbookArgs.builder()
.automationAccountName("ContoseAutomationAccount")
.description("Description of the Runbook")
.location("East US 2")
.logActivityTrace(1)
.logProgress(true)
.logVerbose(false)
.name("Get-AzureVMTutorial")
.publishContentLink(ContentLinkArgs.builder()
.contentHash(ContentHashArgs.builder()
.algorithm("SHA256")
.value("115775B8FF2BE672D8A946BD0B489918C724DDE15A440373CA54461D53010A80")
.build())
.uri("https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-automation-runbook-getvms/Runbooks/Get-AzureVMTutorial.ps1")
.build())
.resourceGroupName("rg")
.runbookName("Get-AzureVMTutorial")
.runbookType("PowerShellWorkflow")
.tags(Map.ofEntries(
Map.entry("tag01", "value01"),
Map.entry("tag02", "value02")
))
.build());
}
}
Create runbook as draft
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var runbook = new AzureNative.Automation.Runbook("runbook", new()
{
AutomationAccountName = "ContoseAutomationAccount",
Description = "Description of the Runbook",
Draft = null,
Location = "East US 2",
LogProgress = false,
LogVerbose = false,
Name = "Get-AzureVMTutorial",
ResourceGroupName = "rg",
RunbookName = "Get-AzureVMTutorial",
RunbookType = AzureNative.Automation.RunbookTypeEnum.PowerShellWorkflow,
Tags =
{
{ "tag01", "value01" },
{ "tag02", "value02" },
},
});
});
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.NewRunbook(ctx, "runbook", &automation.RunbookArgs{
AutomationAccountName: pulumi.String("ContoseAutomationAccount"),
Description: pulumi.String("Description of the Runbook"),
Draft: &automation.RunbookDraftArgs{},
Location: pulumi.String("East US 2"),
LogProgress: pulumi.Bool(false),
LogVerbose: pulumi.Bool(false),
Name: pulumi.String("Get-AzureVMTutorial"),
ResourceGroupName: pulumi.String("rg"),
RunbookName: pulumi.String("Get-AzureVMTutorial"),
RunbookType: pulumi.String(automation.RunbookTypeEnumPowerShellWorkflow),
Tags: pulumi.StringMap{
"tag01": pulumi.String("value01"),
"tag02": pulumi.String("value02"),
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.automation.Runbook;
import com.pulumi.azurenative.automation.RunbookArgs;
import com.pulumi.azurenative.automation.inputs.RunbookDraftArgs;
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 runbook = new Runbook("runbook", RunbookArgs.builder()
.automationAccountName("ContoseAutomationAccount")
.description("Description of the Runbook")
.draft()
.location("East US 2")
.logProgress(false)
.logVerbose(false)
.name("Get-AzureVMTutorial")
.resourceGroupName("rg")
.runbookName("Get-AzureVMTutorial")
.runbookType("PowerShellWorkflow")
.tags(Map.ofEntries(
Map.entry("tag01", "value01"),
Map.entry("tag02", "value02")
))
.build());
}
}
Import
An existing resource can be imported using its type token, name, and identifier, e.g.
$ pulumi import azure-native:automation:Runbook Get-AzureVMTutorial /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}
Properties
The Azure API version of the resource.
Gets or sets the creation time.
Gets or sets the description.
Gets or sets the draft runbook properties.
Gets or sets the last modified by.
Gets or sets the last modified time.
Gets or sets the option to log activity trace of the runbook.
Gets or sets progress log option.
Gets or sets verbose log option.
Gets or sets the runbook output types.
Gets or sets the runbook parameters.
Gets or sets the provisioning state of the runbook.
Gets or sets the type of the runbook.