Skip to main content

runbook

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

Overview

Namerunbook
TypeResource
Idazure.automation.runbook

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.
draftobjectGets or sets the draft runbook properties.
etagstringGets or sets the etag of the resource.
jobCountintegerGets or sets the job count of the runbook.
lastModifiedBystringGets or sets the last modified by.
lastModifiedTimestring (date-time)Gets or sets the last modified time.
locationstringThe geo-location where the resource lives. Required.
logActivityTraceintegerGets or sets the option to log activity trace of the runbook.
logProgressbooleanGets or sets progress log option.
logVerbosebooleanGets or sets verbose log option.
outputTypesarrayGets or sets the runbook output types.
parametersobjectGets or sets the runbook parameters.
provisioningStatestringGets or sets the provisioning state of the runbook. Default value is "Succeeded".
publishContentLinkobjectGets or sets the published runbook content link.
runbookTypestringGets or sets the type of the runbook. Known values are: "Script", "Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", "GraphPowerShell", "Python2", "Python3", "Python", and "PowerShell72". (Script, Graph, PowerShellWorkflow, PowerShell, GraphPowerShellWorkflow, GraphPowerShell, Python2, Python3, Python, PowerShell72)
runtimeEnvironmentstringRuntime Environment of the runbook execution.
statestringGets or sets the state of the runbook. Known values are: "New", "Edit", and "Published". (New, Edit, Published)
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, runbook_name, subscription_idRetrieve the runbook identified by runbook name.
list_by_automation_accountselectresource_group_name, automation_account_name, subscription_idRetrieve a list of runbooks.
create_or_updateinsertresource_group_name, automation_account_name, runbook_name, subscription_id, propertiesCreate the runbook identified by runbook name.
updateupdateresource_group_name, automation_account_name, runbook_name, subscription_idUpdate the runbook identified by runbook name.
create_or_updatereplaceresource_group_name, automation_account_name, runbook_name, subscription_id, propertiesCreate the runbook identified by runbook name.
deletedeleteresource_group_name, automation_account_name, runbook_name, subscription_idDelete the runbook by name.
get_contentexecresource_group_name, automation_account_name, runbook_name, subscription_idRetrieve the content of runbook identified by runbook name.
publishexecresource_group_name, automation_account_name, runbook_name, subscription_idPublish runbook draft.

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.
runbook_namestringThe runbook name. Required.
subscription_idstring

SELECT examples

Retrieve the runbook identified by runbook name.

SELECT
id,
name,
creationTime,
description,
draft,
etag,
jobCount,
lastModifiedBy,
lastModifiedTime,
location,
logActivityTrace,
logProgress,
logVerbose,
outputTypes,
parameters,
provisioningState,
publishContentLink,
runbookType,
runtimeEnvironment,
state,
systemData,
tags,
type
FROM azure.automation.runbook
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND automation_account_name = '{{ automation_account_name }}' -- required
AND runbook_name = '{{ runbook_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;

INSERT examples

Create the runbook identified by runbook name.

INSERT INTO azure.automation.runbook (
properties,
name,
location,
tags,
resource_group_name,
automation_account_name,
runbook_name,
subscription_id
)
SELECT
'{{ properties }}' /* required */,
'{{ name }}',
'{{ location }}',
'{{ tags }}',
'{{ resource_group_name }}',
'{{ automation_account_name }}',
'{{ runbook_name }}',
'{{ subscription_id }}'
RETURNING
id,
name,
etag,
location,
properties,
systemData,
tags,
type
;

UPDATE examples

Update the runbook identified by runbook name.

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

REPLACE examples

Create the runbook identified by runbook name.

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

DELETE examples

Delete the runbook by name.

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

Lifecycle Methods

Retrieve the content of runbook identified by runbook name.

EXEC azure.automation.runbook.get_content 
@resource_group_name='{{ resource_group_name }}' --required,
@automation_account_name='{{ automation_account_name }}' --required,
@runbook_name='{{ runbook_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;