swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  title: AutomationManagement
  version: 2018-06-30
  x-apisguru-categories:
    - cloud
  x-logo:
    url: https://api.apis.guru/v2/cache/logo/https_assets.onestore.ms_cdnfiles_onestorerolling-1606-01000_shell_v3_images_logo_microsoft.png
  x-origin:
    - format: swagger
      url: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/automation/resource-manager/Microsoft.Automation/stable/2018-06-30/runbook.json
      version: "2.0"
  x-preferred: true
  x-providerName: azure.com
  x-serviceName: automation-runbook
  x-tags:
    - Azure
    - Microsoft
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  azure_auth:
    authorizationUrl: https://login.microsoftonline.com/common/oauth2/authorize
    description: Azure Active Directory OAuth2 Flow
    flow: implicit
    scopes:
      user_impersonation: impersonate your user account
    type: oauth2
security:
  - azure_auth:
      - user_impersonation
parameters: {}
paths:
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks":
    get:
      description: Retrieve a list of runbooks.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/runbookoperations
      operationId: Runbook_ListByAutomationAccount
      parameters:
        - description: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
        - description: Name of an Azure Resource group.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the automation account.
          in: path
          name: automationAccountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: Client Api Version.
          in: query
          name: api-version
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/RunbookListResult"
        default:
          description: Automation error response describing why the operation failed.
          schema:
            description: Error response of an operation failure
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - Runbook
      x-ms-examples:
        List runbooks by automation account:
          parameters:
            api-version: 2018-06-30
            automationAccountName: ContoseAutomationAccount
            resourceGroupName: rg
            subscriptionId: subid
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/subid/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/ContoseAutomationAccount/runbooks/ASR-AddPublicIp
                    location: East US 2
                    name: ASR-AddPublicIp
                    properties:
                      creationTime: 2017-03-28T21:32:25.78+00:00
                      lastModifiedTime: 2017-03-28T21:32:25.81+00:00
                      logActivityTrace: 1
                      logProgress: true
                      logVerbose: true
                      runbookType: PowerShell
                      state: Published
                    type: Microsoft.Automation/AutomationAccounts/Runbooks
                  - id: /subscriptions/subid/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/ContoseAutomationAccount/runbooks/AutoExport
                    location: East US 2
                    name: AutoExport
                    properties:
                      creationTime: 2017-03-28T21:32:27.327+00:00
                      lastModifiedTime: 2017-03-28T21:32:27.327+00:00
                      logActivityTrace: 1
                      logProgress: true
                      logVerbose: true
                      runbookType: PowerShell
                      state: Published
                    type: Microsoft.Automation/AutomationAccounts/Runbooks
                  - id: /subscriptions/subid/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/ContoseAutomationAccount/runbooks/Get-AzureVMTutorial
                    location: East US 2
                    name: Get-AzureVMTutorial
                    properties:
                      creationTime: 2017-03-28T21:32:23.75+00:00
                      lastModifiedTime: 2017-03-28T21:32:23.75+00:00
                      logActivityTrace: 1
                      logProgress: true
                      logVerbose: false
                      runbookType: PowerShellWorkflow
                      state: Published
                    type: Microsoft.Automation/AutomationAccounts/Runbooks
              headers: {}
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}":
    delete:
      description: Delete the runbook by name.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/runbookoperations
      operationId: Runbook_Delete
      parameters:
        - description: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
        - description: Name of an Azure Resource group.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the automation account.
          in: path
          name: automationAccountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The runbook name.
          in: path
          name: runbookName
          required: true
          type: string
        - description: Client Api Version.
          in: query
          name: api-version
          required: true
          type: string
      responses:
        "200":
          description: OK
        "204":
          description: No Content
        default:
          description: Automation error response describing why the operation failed.
          schema:
            description: Error response of an operation failure
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - Runbook
      x-ms-examples:
        Delete a runbook:
          parameters:
            api-version: 2018-06-30
            automationAccountName: ContoseAutomationAccount
            resourceGroupName: rg
            runbookName: Get-AzureVMTutorial
            subscriptionId: subid
          responses:
            "200": {}
            "204": {}
    get:
      description: Retrieve the runbook identified by runbook name.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/runbookoperations
      operationId: Runbook_Get
      parameters:
        - description: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
        - description: Name of an Azure Resource group.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the automation account.
          in: path
          name: automationAccountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The runbook name.
          in: path
          name: runbookName
          required: true
          type: string
        - description: Client Api Version.
          in: query
          name: api-version
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/Runbook"
        default:
          description: Automation error response describing why the operation failed.
          schema:
            description: Error response of an operation failure
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - Runbook
      x-ms-examples:
        Get runbook:
          parameters:
            api-version: 2018-06-30
            automationAccountName: ContoseAutomationAccount
            resourceGroupName: rg
            runbookName: Get-AzureVMTutorial
            subscriptionId: subid
          responses:
            "200":
              body:
                etag: '"636263335437500000"'
                id: /subscriptions/subid/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/ContoseAutomationAccount/runbooks/Get-AzureVMTutorial
                location: East US 2
                name: Get-AzureVMTutorial
                properties:
                  creationTime: 2017-03-28T21:32:23.75+00:00
                  description: Description of the Runbook
                  jobCount: 0
                  lastModifiedBy: myEmaild@microsoft.com
                  lastModifiedTime: 2017-03-28T21:32:23.75+00:00
                  logActivityTrace: 1
                  logProgress: true
                  logVerbose: false
                  outputTypes: []
                  parameters: {}
                  provisioningState: Succeeded
                  runbookType: PowerShellWorkflow
                  state: Published
                tags:
                  tag01: value01
                  tag02: value02
                type: Microsoft.Automation/AutomationAccounts/Runbooks
              headers: {}
    patch:
      description: Update the runbook identified by runbook name.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/runbookoperations
      operationId: Runbook_Update
      parameters:
        - description: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
        - description: Name of an Azure Resource group.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the automation account.
          in: path
          name: automationAccountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The runbook name.
          in: path
          name: runbookName
          required: true
          type: string
        - description: The update parameters for runbook.
          in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/RunbookUpdateParameters"
        - description: Client Api Version.
          in: query
          name: api-version
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/Runbook"
        default:
          description: Automation error response describing why the operation failed.
          schema:
            description: Error response of an operation failure
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - Runbook
      x-ms-examples:
        Update runbook:
          parameters:
            api-version: 2018-06-30
            automationAccountName: ContoseAutomationAccount
            parameters:
              properties:
                description: Updated Description of the Runbook
                logActivityTrace: 1
                logProgress: true
                logVerbose: false
            resourceGroupName: rg
            runbookName: Get-AzureVMTutorial
            subscriptionId: subid
          responses:
            "200":
              etag: '"636265044994500000"'
              id: /subscriptions/subid/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/ContoseAutomationAccount/runbooks/Get-AzureVMTutorial
              location: East US 2
              name: Get-AzureVMTutorial
              properties:
                creationTime: 2017-03-30T21:01:33.777+00:00
                description: Updated Description of the Runbook
                jobCount: 0
                lastModifiedBy: myEmaild@microsoft.com
                lastModifiedTime: 2017-03-30T21:01:39.45+00:00
                logActivityTrace: 1
                logProgress: true
                logVerbose: false
                outputTypes: []
                parameters: {}
                provisioningState: Succeeded
                runbookType: PowerShellWorkflow
                state: Published
              tags:
                tag01: value01
                tag02: value02
              type: Microsoft.Automation/AutomationAccounts/Runbooks
    put:
      description: Create the runbook identified by runbook name.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/runbookoperations
      operationId: Runbook_CreateOrUpdate
      parameters:
        - description: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
        - description: Name of an Azure Resource group.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the automation account.
          in: path
          name: automationAccountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The runbook name.
          in: path
          name: runbookName
          required: true
          type: string
        - description: The create or update parameters for runbook. Provide either content link for a published runbook or draft, not both.
          in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/RunbookCreateOrUpdateParameters"
        - description: Client Api Version.
          in: query
          name: api-version
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/Runbook"
        "201":
          description: Created
          schema:
            $ref: "#/definitions/Runbook"
        default:
          description: Automation error response describing why the operation failed.
          schema:
            description: Error response of an operation failure
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - Runbook
      x-ms-examples:
        Create or update runbook and publish it:
          parameters:
            api-version: 2018-06-30
            automationAccountName: ContoseAutomationAccount
            parameters:
              location: East US 2
              name: Get-AzureVMTutorial
              properties:
                description: Description of the Runbook
                logActivityTrace: 1
                logProgress: true
                logVerbose: false
                publishContentLink:
                  contentHash:
                    algorithm: SHA256
                    value: 115775B8FF2BE672D8A946BD0B489918C724DDE15A440373CA54461D53010A80
                  uri: https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-automation-runbook-getvms/Runbooks/Get-AzureVMTutorial.ps1
                runbookType: PowerShellWorkflow
              tags:
                tag01: value01
                tag02: value02
            resourceGroupName: rg
            runbookName: Get-AzureVMTutorial
            subscriptionId: subid
          responses:
            "200":
              body:
                etag: '"636263318866000000"'
                id: /subscriptions/subid/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/ContoseAutomationAccount/runbooks/Get-AzureVMTutorial
                location: East US 2
                name: Get-AzureVMTutorial
                properties:
                  creationTime: 2017-03-28T21:04:43.66+00:00
                  description: Description of the Runbook
                  jobCount: 0
                  lastModifiedBy: myEmaild@microsoft.com
                  lastModifiedTime: 2017-03-28T21:04:46.6+00:00
                  logActivityTrace: 1
                  logProgress: true
                  logVerbose: true
                  outputTypes: []
                  parameters: {}
                  provisioningState: Succeeded
                  runbookType: PowerShellWorkflow
                  state: Published
                tags:
                  tag01: value01
                  tag02: value02
                type: Microsoft.Automation/AutomationAccounts/Runbooks
              headers: {}
            "201":
              body:
                etag: '"636263318837230000"'
                id: /subscriptions/subid/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/ContoseAutomationAccount/runbooks/Get-AzureVMTutorial
                location: East US 2
                name: Get-AzureVMTutorial
                properties:
                  creationTime: 2017-03-28T21:04:43.66+00:00
                  description: Description of the Runbook
                  jobCount: 0
                  lastModifiedBy: myEmaild@microsoft.com
                  lastModifiedTime: 2017-03-28T21:04:43.723+00:00
                  logActivityTrace: 1
                  logProgress: true
                  logVerbose: false
                  outputTypes: []
                  parameters: {}
                  provisioningState: Succeeded
                  runbookType: PowerShellWorkflow
                  state: Published
                tags:
                  tag01: value01
                  tag02: value02
                type: Microsoft.Automation/AutomationAccounts/Runbooks
              headers: {}
        Create runbook as draft:
          parameters:
            api-version: 2018-06-30
            automationAccountName: ContoseAutomationAccount
            parameters:
              location: East US 2
              name: Get-AzureVMTutorial
              properties:
                description: Description of the Runbook
                draft: {}
                logProgress: false
                logVerbose: false
                runbookType: PowerShellWorkflow
              tags:
                tag01: value01
                tag02: value02
            resourceGroupName: rg
            runbookName: Get-AzureVMTutorial
            subscriptionId: subid
          responses:
            "200":
              body:
                etag: '"636263318866000000"'
                id: /subscriptions/subid/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/ContoseAutomationAccount/runbooks/Get-AzureVMTutorial
                location: East US 2
                name: Get-AzureVMTutorial
                properties:
                  creationTime: 2018-02-09T03:25:59.097+00:00
                  description: Description of the Runbook
                  jobCount: 0
                  lastModifiedTime: 2018-02-09T03:25:59.097+00:00
                  logActivityTrace: 0
                  logProgress: false
                  logVerbose: false
                  parameters: {}
                  provisioningState: Succeeded
                  runbookType: Script
                  state: New
                tags:
                  tag01: value01
                  tag02: value02
                type: Microsoft.Automation/AutomationAccounts/Runbooks
              headers: {}
            "201":
              body:
                etag: '"636263318837230000"'
                id: /subscriptions/subid/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/ContoseAutomationAccount/runbooks/Get-AzureVMTutorial
                location: East US 2
                name: Get-AzureVMTutorial
                properties:
                  creationTime: 2018-02-09T03:25:59.097+00:00
                  description: Description of the Runbook
                  jobCount: 0
                  lastModifiedTime: 2018-02-09T03:25:59.097+00:00
                  logActivityTrace: 0
                  logProgress: false
                  logVerbose: false
                  outputTypes: []
                  parameters: {}
                  provisioningState: Succeeded
                  runbookType: Script
                  state: New
                tags:
                  tag01: value01
                  tag02: value02
                type: Microsoft.Automation/AutomationAccounts/Runbooks
              headers: {}
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/content":
    get:
      description: Retrieve the content of runbook identified by runbook name.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/runbookoperations
      operationId: Runbook_GetContent
      parameters:
        - description: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
        - description: Name of an Azure Resource group.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the automation account.
          in: path
          name: automationAccountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The runbook name.
          in: path
          name: runbookName
          required: true
          type: string
        - description: Client Api Version.
          in: query
          name: api-version
          required: true
          type: string
      produces:
        - text/powershell
      responses:
        "200":
          description: OK
          schema:
            type: file
        default:
          description: Automation error response describing why the operation failed.
          schema:
            description: Error response of an operation failure
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - Runbook
      x-ms-examples:
        Get runbook content:
          parameters:
            api-version: 2018-06-30
            automationAccountName: ContoseAutomationAccount
            resourceGroupName: rg
            runbookName: Get-AzureVMTutorial
            subscriptionId: subid
          responses:
            "200":
              body: "<#\r

                \    .DESCRIPTION\r

                \        An example runbook which prints out the first10 Azure VMs in your subscription (ordered alphabetically).\r

                \        For more information about how this runbook authenticates to your Azure subscription, see our documentation here: http: //aka.ms/fxu3mn\r

                \r

                \    .NOTES\r

                \        AUTHOR: Azure Automation Team\r

                \        LASTEDIT: Mar27,\r

                \            2015\r

                #>\r

                workflow Get-AzureVMTutorial{\r

                \    #The name of the Automation Credential Asset this runbook will use to authenticate to Azure.\r

                \    $CredentialAssetName = 'DefaultAzureCredential'\r

                \r

                \    #Get the credential with the above name from the Automation Asset store\r

                \    $Cred = Get-AutomationPSCredential -Name $CredentialAssetName\r

                \    if(!$Cred){\r

                \        Throw\"Could not find an Automation Credential Asset named '${CredentialAssetName}'. Make sure you have created one in this Automation Account.\"\r

                \                }\r

                \r

                \    #Connect to your Azure Account\r

                \    $Account = Add-AzureAccount -Credential $Cred\r

                \    if(!$Account){\r

                \        Throw\"Could not authenticate to Azure using the credential asset '${CredentialAssetName}'. Make sure the user name and password are correct.\"\r

                \                }\r

                \r

                \    #TODO (optional): pick the right subscription to use. Without this line, the default subscription for your Azure Account will be used.\r

                \    #Select-AzureSubscription -SubscriptionName\"TODO: your Azure subscription name here\"\r

                \    \r

                \    #Get all the VMs you have in your Azure subscription\r

                \    $VMs = Get-AzureVM\r

                \r

                \    #Print out up to10 of those VMs\r

                \    if(!$VMs){\r

                \        Write-Output\"No VMs were found in your subscription.\"\r

                \                } else{\r

                \        Write-Output $VMs[0..9\r

                \                    ]\r

                \                }\r

                \            }"
              headers:
                Content-Type: text/powershell
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft":
    get:
      description: Retrieve the runbook draft identified by runbook name.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/runbookdraftoperations
      operationId: RunbookDraft_Get
      parameters:
        - description: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
        - description: Name of an Azure Resource group.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the automation account.
          in: path
          name: automationAccountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The runbook name.
          in: path
          name: runbookName
          required: true
          type: string
        - description: Client Api Version.
          in: query
          name: api-version
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/RunbookDraft"
        default:
          description: Automation error response describing why the operation failed.
          schema:
            description: Error response of an operation failure
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - RunbookDraft
      x-ms-examples:
        Get runbook draft:
          parameters:
            api-version: 2018-06-30
            automationAccountName: ContoseAutomationAccount
            resourceGroupName: rg
            runbookName: Get-AzureVMTutorial
            subscriptionId: subid
          responses:
            "200":
              body:
                creationTime: 2018-02-09T03:25:59.11+00:00
                inEdit: true
                lastModifiedTime: 2018-02-09T04:48:56.43+00:00
                outputTypes: []
                parameters: {}
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content":
    get:
      description: Retrieve the content of runbook draft identified by runbook name.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/runbookdraftoperations
      operationId: RunbookDraft_GetContent
      parameters:
        - description: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
        - description: Name of an Azure Resource group.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the automation account.
          in: path
          name: automationAccountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The runbook name.
          in: path
          name: runbookName
          required: true
          type: string
        - description: Client Api Version.
          in: query
          name: api-version
          required: true
          type: string
      produces:
        - text/powershell
      responses:
        "200":
          description: OK
          schema:
            type: file
        default:
          description: Automation error response describing why the operation failed.
          schema:
            description: Error response of an operation failure
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - RunbookDraft
      x-ms-examples:
        Get runbook draft content:
          parameters:
            api-version: 2018-06-30
            automationAccountName: ContoseAutomationAccount
            resourceGroupName: rg
            runbookName: Get-AzureVMTutorial
            subscriptionId: subid
          responses:
            "200":
              body: "<#\r

                \    .DESCRIPTION\r

                \        An example runbook which prints out the first10 Azure VMs in your subscription (ordered alphabetically).\r

                \        For more information about how this runbook authenticates to your Azure subscription, see our documentation here: http: //aka.ms/fxu3mn\r

                \r

                \    .NOTES\r

                \        AUTHOR: Azure Automation Team\r

                \        LASTEDIT: Mar27,\r

                \            2015\r

                #>\r

                workflow Get-AzureVMTutorial{\r

                \    #The name of the Automation Credential Asset this runbook will use to authenticate to Azure.\r

                \    $CredentialAssetName = 'DefaultAzureCredential'\r

                \r

                \    #Get the credential with the above name from the Automation Asset store\r

                \    $Cred = Get-AutomationPSCredential -Name $CredentialAssetName\r

                \    if(!$Cred){\r

                \        Throw\"Could not find an Automation Credential Asset named '${CredentialAssetName}'. Make sure you have created one in this Automation Account.\"\r

                \                }\r

                \r

                \    #Connect to your Azure Account\r

                \    $Account = Add-AzureAccount -Credential $Cred\r

                \    if(!$Account){\r

                \        Throw\"Could not authenticate to Azure using the credential asset '${CredentialAssetName}'. Make sure the user name and password are correct.\"\r

                \                }\r

                \r

                \    #TODO (optional): pick the right subscription to use. Without this line, the default subscription for your Azure Account will be used.\r

                \    #Select-AzureSubscription -SubscriptionName\"TODO: your Azure subscription name here\"\r

                \    \r

                \    #Get all the VMs you have in your Azure subscription\r

                \    $VMs = Get-AzureVM\r

                \r

                \    #Print out up to10 of those VMs\r

                \    if(!$VMs){\r

                \        Write-Output\"No VMs were found in your subscription.\"\r

                \                } else{\r

                \        Write-Output $VMs[0..9\r

                \                    ]\r

                \                }\r

                \            }"
              headers:
                Content-Type: text/powershell
    put:
      consumes:
        - text/powershell
      description: Replaces the runbook draft content.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/runbookdraftoperations
      operationId: RunbookDraft_ReplaceContent
      parameters:
        - description: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
        - description: Name of an Azure Resource group.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the automation account.
          in: path
          name: automationAccountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The runbook name.
          in: path
          name: runbookName
          required: true
          type: string
        - description: The runbook draft content.
          in: body
          name: runbookContent
          required: true
          schema:
            format: file
            type: object
        - description: Client Api Version.
          in: query
          name: api-version
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            type: file
        "202":
          description: Accepted and  the operation will complete asynchronously.
          headers:
            location:
              description: URL to query for status of the operation.
              type: string
        default:
          description: Automation error response describing why the operation failed.
          schema:
            description: Error response of an operation failure
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - RunbookDraft
      x-ms-examples:
        Create or update runbook draft:
          parameters:
            api-version: 2018-06-30
            automationAccountName: ContoseAutomationAccount
            resourceGroupName: rg
            runbookContent: "<#\r

              \        .DESCRIPTION\r

              \            An example runbook which prints out the first10 Azure VMs in your subscription (ordered alphabetically).\r

              \            For more information about how this runbook authenticates to your Azure subscription, see our documentation here: http: //aka.ms/fxu3mn\r

              \r

              \        .NOTES\r

              \            AUTHOR: Azure Automation Team\r

              \            LASTEDIT: Mar27,\r

              \            2015\r

              \    #>\r

              \    workflow Get-AzureVMTutorial{\r

              \        #The name of the Automation Credential Asset this runbook will use to authenticate to Azure.\r

              \        $CredentialAssetName = 'DefaultAzureCredential'\r

              \r

              \        #Get the credential with the above name from the Automation Asset store\r

              \        $Cred = Get-AutomationPSCredential -Name $CredentialAssetName\r

              \        if(!$Cred){\r

              \            Throw\"Could not find an Automation Credential Asset named '${CredentialAssetName}'. Make sure you have created one in this Automation Account.\"\r

              \                }\r

              \r

              \        #Connect to your Azure Account\r

              \        $Account = Add-AzureAccount -Credential $Cred\r

              \        if(!$Account){\r

              \            Throw\"Could not authenticate to Azure using the credential asset '${CredentialAssetName}'. Make sure the user name and password are correct.\"\r

              \                }\r

              \r

              \        #TODO (optional): pick the right subscription to use. Without this line, the default subscription for your Azure Account will be used.\r

              \        #Select-AzureSubscription -SubscriptionName\"TODO: your Azure subscription name here\"\r

              \        \r

              \        #Get all the VMs you have in your Azure subscription\r

              \        $VMs = Get-AzureVM\r

              \r

              \        #Print out up to10 of those VMs\r

              \        if(!$VMs){\r

              \            Write-Output\"No VMs were found in your subscription.\"\r

              \                } else{\r

              \            Write-Output $VMs[0..9\r

              \                    ]\r

              \                }\r

              \            }"
            runbookName: Get-AzureVMTutorial
            subscriptionId: subid
          responses:
            "200": {}
            "202":
              body: {}
              headers:
                Location: https://management.azure.com/subscriptions/subid/resourcegroups/rg/providers/Microsoft.Automation/automationAccounts/ContoseAutomationAccount/runbooks/Get-AzureVMTutorial/draft/content/operationResults/9bd70be2-cf73-49b4-9467-5261d48c2b3d?api-version=2015-10-31
      x-ms-long-running-operation: true
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob":
    get:
      description: Retrieve the test job for the specified runbook.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/testjoboperations
      operationId: TestJob_Get
      parameters:
        - description: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
        - description: Name of an Azure Resource group.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the automation account.
          in: path
          name: automationAccountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The runbook name.
          in: path
          name: runbookName
          required: true
          type: string
        - description: Client Api Version.
          in: query
          name: api-version
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/TestJob"
        default:
          description: Automation error response describing why the operation failed.
          schema:
            description: Error response of an operation failure
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - TestJob
      x-ms-examples:
        Get test job:
          parameters:
            api-version: 2018-06-30
            automationAccountName: ContoseAutomationAccount
            resourceGroupName: mygroup
            runbookName: Get-AzureVMTutorial
            subscriptionId: 51766542-3ed7-4a72-a187-0c8ab644ddab
          responses:
            "200":
              body:
                creationTime: 2018-02-09T05:52:00.9344172+00:00
                endTime: 2018-02-09T05:55:16.7827254+00:00
                exception: null
                lastModifiedTime: 2018-02-09T05:55:16.7827254+00:00
                lastStatusModifiedTime: 2018-02-09T05:55:16.7827254+00:00
                logActivityTrace: null
                parameters: {}
                runOn: null
                startTime: 2018-02-09T05:55:10.8344743+00:00
                status: Completed
                statusDetails: None
              headers: {}
    put:
      description: Create a test job of the runbook.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/testjoboperations
      operationId: TestJob_Create
      parameters:
        - description: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
        - description: Name of an Azure Resource group.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the automation account.
          in: path
          name: automationAccountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The parameters supplied to the create test job operation.
          in: path
          name: runbookName
          required: true
          type: string
        - description: The parameters supplied to the create test job operation.
          in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/TestJobCreateParameters"
        - description: Client Api Version.
          in: query
          name: api-version
          required: true
          type: string
      responses:
        "201":
          description: Created
          schema:
            $ref: "#/definitions/TestJob"
        default:
          description: Automation error response describing why the operation failed.
          schema:
            description: Error response of an operation failure
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - TestJob
      x-ms-examples:
        Create test job:
          parameters:
            api-version: 2018-06-30
            automationAccountName: ContoseAutomationAccount
            parameters:
              parameters:
                key01: value01
                key02: value02
              runOn: ""
            resourceGroupName: mygroup
            runbookName: Get-AzureVMTutorial
            subscriptionId: 51766542-3ed7-4a72-a187-0c8ab644ddab
          responses:
            "201":
              body:
                creationTime: 2018-02-09T05:51:59.82+00:00
                endTime: null
                exception: null
                lastModifiedTime: 2018-02-09T05:51:59.82+00:00
                lastStatusModifiedTime: 2018-02-09T05:51:59.82+00:00
                logActivityTrace: null
                parameters: {}
                runOn: null
                startTime: null
                status: New
                statusDetails: None
              headers: {}
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/resume":
    post:
      description: Resume the test job.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/testjoboperations
      operationId: TestJob_Resume
      parameters:
        - description: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
        - description: Name of an Azure Resource group.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the automation account.
          in: path
          name: automationAccountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The runbook name.
          in: path
          name: runbookName
          required: true
          type: string
        - description: Client Api Version.
          in: query
          name: api-version
          required: true
          type: string
      responses:
        "200":
          description: OK
        default:
          description: Automation error response describing why the operation failed.
          schema:
            description: Error response of an operation failure
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - TestJob
      x-ms-examples:
        Resume test job:
          parameters:
            api-version: 2018-06-30
            automationAccountName: ContoseAutomationAccount
            resourceGroupName: mygroup
            runbookName: Get-AzureVMTutorial
            subscriptionId: 51766542-3ed7-4a72-a187-0c8ab644ddab
          responses:
            "200": {}
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/stop":
    post:
      description: Stop the test job.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/testjoboperations
      operationId: TestJob_Stop
      parameters:
        - description: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
        - description: Name of an Azure Resource group.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the automation account.
          in: path
          name: automationAccountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The runbook name.
          in: path
          name: runbookName
          required: true
          type: string
        - description: Client Api Version.
          in: query
          name: api-version
          required: true
          type: string
      responses:
        "200":
          description: OK
        default:
          description: Automation error response describing why the operation failed.
          schema:
            description: Error response of an operation failure
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - TestJob
      x-ms-examples:
        Stop test job:
          parameters:
            api-version: 2018-06-30
            automationAccountName: ContoseAutomationAccount
            resourceGroupName: mygroup
            runbookName: Get-AzureVMTutorial
            subscriptionId: 51766542-3ed7-4a72-a187-0c8ab644ddab
          responses:
            "200": {}
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/streams":
    get:
      description: Retrieve a list of test job streams identified by runbook name.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/jobstreamoperations
      operationId: TestJobStreams_ListByTestJob
      parameters:
        - description: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
        - description: Name of an Azure Resource group.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the automation account.
          in: path
          name: automationAccountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The runbook name.
          in: path
          name: runbookName
          required: true
          type: string
        - description: The filter to apply on the operation.
          in: query
          name: $filter
          required: false
          type: string
        - description: Client Api Version.
          in: query
          name: api-version
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/JobStreamListResult"
        default:
          description: Automation error response describing why the operation failed.
          schema:
            description: Error response of an operation failure
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - TestJobStream
      x-ms-examples:
        List job streams by job name:
          parameters:
            api-version: 2018-06-30
            automationAccountName: ContoseAutomationAccount
            resourceGroupName: mygroup
            runbookName: Get-AzureVMTutorial
            subscriptionId: 51766542-3ed7-4a72-a187-0c8ab644ddab
          responses:
            "200":
              body:
                nextLink: null
                value:
                  - id: /subscriptions/51766542-3ed7-4a72-a187-0c8ab644ddab/resourcegroups/mygroup/providers/Microsoft.Automation/automationAccounts/ContoseAutomationAccount/jobs/jobName/streams/24456a8a-2857-4af6-932c-3455f38bd05e_00636535675981232703_00000000000000000001
                    properties:
                      jobStreamId: 24456a8a-2857-4af6-932c-3455f38bd05e_00636535675981232703_00000000000000000001
                      streamType: Output
                      summary: null
                      time: 2018-02-07T02:33:18.1232703+00:00
                  - id: /subscriptions/51766542-3ed7-4a72-a187-0c8ab644ddab/resourcegroups/mygroup/providers/Microsoft.Automation/automationAccounts/ContoseAutomationAccount/jobs/jobName/streams/24456a8a-2857-4af6-932c-3455f38bd05e_00636535675984691350_00000000000000000002
                    properties:
                      jobStreamId: 24456a8a-2857-4af6-932c-3455f38bd05e_00636535675984691350_00000000000000000002
                      streamType: Output
                      summary: null
                      time: 2018-02-07T02:33:18.469135+00:00
              headers: {}
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/streams/{jobStreamId}":
    get:
      description: Retrieve a test job stream of the test job identified by runbook name and stream id.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/jobstreamoperations
      operationId: TestJobStreams_Get
      parameters:
        - description: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
        - description: Name of an Azure Resource group.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the automation account.
          in: path
          name: automationAccountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The runbook name.
          in: path
          name: runbookName
          required: true
          type: string
        - description: The job stream id.
          in: path
          name: jobStreamId
          required: true
          type: string
        - description: Client Api Version.
          in: query
          name: api-version
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/JobStream"
        default:
          description: Automation error response describing why the operation failed.
          schema:
            description: Error response of an operation failure
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - TestJobStream
      x-ms-examples:
        Get test job stream:
          parameters:
            api-version: 2018-06-30
            automationAccountName: ContoseAutomationAccount
            jobStreamId: 851b2101-686f-40e2-8a4b-5b8df08afbd1_00636535684910693884_00000000000000000001
            resourceGroupName: mygroup
            runbookName: Get-AzureVMTutorial
            subscriptionId: 51766542-3ed7-4a72-a187-0c8ab644ddab
          responses:
            "200":
              body:
                id: /subscriptions/51766542-3ed7-4a72-a187-0c8ab644ddab/resourcegroups/mygroup/providers/Microsoft.Automation/automationAccounts/ContoseAutomationAccount/runbooks/foo/draft/testJob/streams/851b2101-686f-40e2-8a4b-5b8df08afbd1_00636535684910693884_00000000000000000001
                properties:
                  jobStreamId: 851b2101-686f-40e2-8a4b-5b8df08afbd1:00636535684910693884:00000000000000000001
                  streamText: ""
                  streamType: Output
                  summary: null
                  time: 2018-02-07T02:48:11.0693884+00:00
                  value: {}
              headers: {}
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/suspend":
    post:
      description: Suspend the test job.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/testjoboperations
      operationId: TestJob_Suspend
      parameters:
        - description: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
        - description: Name of an Azure Resource group.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the automation account.
          in: path
          name: automationAccountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The runbook name.
          in: path
          name: runbookName
          required: true
          type: string
        - description: Client Api Version.
          in: query
          name: api-version
          required: true
          type: string
      responses:
        "200":
          description: OK
        default:
          description: Automation error response describing why the operation failed.
          schema:
            description: Error response of an operation failure
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - TestJob
      x-ms-examples:
        Suspend test job:
          parameters:
            api-version: 2018-06-30
            automationAccountName: ContoseAutomationAccount
            resourceGroupName: mygroup
            runbookName: Get-AzureVMTutorial
            subscriptionId: 51766542-3ed7-4a72-a187-0c8ab644ddab
          responses:
            "200": {}
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/undoEdit":
    post:
      description: Undo draft edit to last known published state identified by runbook name.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/runbookdraftoperations
      operationId: RunbookDraft_UndoEdit
      parameters:
        - description: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
        - description: Name of an Azure Resource group.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the automation account.
          in: path
          name: automationAccountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The runbook name.
          in: path
          name: runbookName
          required: true
          type: string
        - description: Client Api Version.
          in: query
          name: api-version
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/RunbookDraftUndoEditResult"
        default:
          description: Automation error response describing why the operation failed.
          schema:
            description: Error response of an operation failure
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - RunbookDraft
      x-ms-examples:
        Undo draft edit to last known published state:
          parameters:
            api-version: 2018-06-30
            automationAccountName: ContoseAutomationAccount
            resourceGroupName: rg
            runbookName: Get-AzureVMTutorial
            subscriptionId: subid
          responses:
            "200": {}
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/publish":
    post:
      description: Publish runbook draft.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/runbookdraftoperations
      operationId: Runbook_Publish
      parameters:
        - description: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
        - description: Name of an Azure Resource group.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the automation account.
          in: path
          name: automationAccountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The parameters supplied to the publish runbook operation.
          in: path
          name: runbookName
          required: true
          type: string
        - description: Client Api Version.
          in: query
          name: api-version
          required: true
          type: string
      responses:
        "202":
          description: Accepted and  the operation will complete asynchronously.
          headers:
            location:
              description: URL to query for status of the operation.
              type: string
        default:
          description: Automation error response describing why the operation failed.
          schema:
            description: Error response of an operation failure
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - Runbook
      x-ms-examples:
        Publish runbook draft:
          parameters:
            api-version: 2018-06-30
            automationAccountName: ContoseAutomationAccount
            resourceGroupName: rg
            runbookName: Get-AzureVMTutorial
            subscriptionId: subid
          responses:
            "202":
              headers:
                Location: https://management.azure.com/subscriptions/subid/resourcegroups/rg/providers/Microsoft.Automation/automationAccounts/ContoseAutomationAccount/runbooks/Get-AzureVMTutorial/publish/operationResults/9bd70be2-cf73-49b4-9467-5261d48c2b3d?api-version=2018-06-30
      x-ms-long-running-operation: true
definitions:
  ContentHash:
    description: Definition of the runbook property type.
    properties:
      algorithm:
        description: Gets or sets the content hash algorithm used to hash the content.
        type: string
      value:
        description: Gets or sets expected hash value of the content.
        type: string
    required:
      - algorithm
      - value
  ContentLink:
    description: Definition of the content link.
    properties:
      contentHash:
        $ref: "#/definitions/ContentHash"
        description: Gets or sets the hash.
      uri:
        description: Gets or sets the uri of the runbook content.
        type: string
      version:
        description: Gets or sets the version of the content.
        type: string
  JobStream:
    description: Definition of the job stream.
    properties:
      id:
        description: Gets or sets the id of the resource.
        type: string
      properties:
        $ref: "#/definitions/JobStreamProperties"
        description: Gets or sets the id of the job stream.
        x-ms-client-flatten: true
  JobStreamListResult:
    description: The response model for the list job stream operation.
    properties:
      nextLink:
        description: Gets or sets the next link.
        type: string
      value:
        description: A list of job streams.
        items:
          $ref: "#/definitions/JobStream"
        type: array
  JobStreamProperties:
    description: Definition of the job stream.
    properties:
      jobStreamId:
        description: Gets or sets the id of the job stream.
        type: string
      streamText:
        description: Gets or sets the stream text.
        type: string
      streamType:
        description: Gets or sets the stream type.
        enum:
          - Progress
          - Output
          - Warning
          - Error
          - Debug
          - Verbose
          - Any
        type: string
        x-ms-enum:
          modelAsString: true
          name: JobStreamType
      summary:
        description: Gets or sets the summary.
        type: string
      time:
        description: Gets or sets the creation time of the job.
        format: date-time
        type: string
        x-nullable: false
      value:
        additionalProperties:
          type: object
        description: Gets or sets the values of the job stream.
        type: object
    x-ms-client-flatten: true
  Runbook:
    allOf:
      - allOf:
          - description: The core properties of ARM resources
            properties:
              id:
                description: Fully qualified resource Id for the resource
                readOnly: true
                type: string
              name:
                description: The name of the resource
                readOnly: true
                type: string
              type:
                description: The type of the resource.
                readOnly: true
                type: string
            type: object
            x-ms-azure-resource: true
        description: The resource model definition for a ARM tracked top level resource
        properties:
          location:
            description: The Azure Region where the resource lives
            type: string
            x-ms-mutability:
              - read
              - create
          tags:
            additionalProperties:
              type: string
            description: Resource tags.
            type: object
            x-ms-mutability:
              - read
              - create
              - update
        type: object
    description: Definition of the runbook type.
    properties:
      etag:
        description: Gets or sets the etag of the resource.
        type: string
      properties:
        $ref: "#/definitions/RunbookProperties"
        description: Gets or sets the runbook properties.
        x-ms-client-flatten: true
  RunbookCreateOrUpdateDraftParameters:
    description: The parameters supplied to the create or update runbook operation.
    properties:
      runbookContent:
        description: Content of the Runbook.
        type: string
    required:
      - runbookContent
    x-ms-client-flatten: true
  RunbookCreateOrUpdateDraftProperties:
    description: The parameters supplied to the create or update draft runbook properties.
    properties:
      description:
        description: Gets or sets the description of the runbook.
        type: string
      draft:
        $ref: "#/definitions/RunbookDraft"
        description: Gets or sets the draft runbook properties.
      logActivityTrace:
        description: Gets or sets the activity-level tracing options of the runbook.
        format: int32
        type: integer
      logProgress:
        description: Gets or sets progress log option.
        type: boolean
      logVerbose:
        description: Gets or sets verbose log option.
        type: boolean
      runbookType:
        description: Gets or sets the type of the runbook.
        enum:
          - Script
          - Graph
          - PowerShellWorkflow
          - PowerShell
          - GraphPowerShellWorkflow
          - GraphPowerShell
        type: string
        x-ms-enum:
          modelAsString: true
          name: RunbookTypeEnum
    required:
      - runbookType
      - draft
  RunbookCreateOrUpdateParameters:
    description: The parameters supplied to the create or update runbook operation.
    properties:
      location:
        description: Gets or sets the location of the resource.
        type: string
      name:
        description: Gets or sets the name of the resource.
        type: string
      properties:
        $ref: "#/definitions/RunbookCreateOrUpdateProperties"
        description: Gets or sets runbook create or update properties.
        x-ms-client-flatten: true
      tags:
        additionalProperties:
          type: string
        description: Gets or sets the tags attached to the resource.
        type: object
    required:
      - properties
  RunbookCreateOrUpdateProperties:
    description: The parameters supplied to the create or update runbook properties.
    properties:
      description:
        description: Gets or sets the description of the runbook.
        type: string
      draft:
        $ref: "#/definitions/RunbookDraft"
        description: Gets or sets the draft runbook properties.
      logActivityTrace:
        description: Gets or sets the activity-level tracing options of the runbook.
        format: int32
        type: integer
      logProgress:
        description: Gets or sets progress log option.
        type: boolean
      logVerbose:
        description: Gets or sets verbose log option.
        type: boolean
      publishContentLink:
        $ref: "#/definitions/ContentLink"
        description: Gets or sets the published runbook content link.
      runbookType:
        description: Gets or sets the type of the runbook.
        enum:
          - Script
          - Graph
          - PowerShellWorkflow
          - PowerShell
          - GraphPowerShellWorkflow
          - GraphPowerShell
        type: string
        x-ms-enum:
          modelAsString: true
          name: RunbookTypeEnum
    required:
      - runbookType
  RunbookDraft:
    properties:
      creationTime:
        description: Gets or sets the creation time of the runbook draft.
        format: date-time
        type: string
        x-nullable: false
      draftContentLink:
        $ref: "#/definitions/ContentLink"
        description: Gets or sets the draft runbook content link.
      inEdit:
        description: Gets or sets whether runbook is in edit mode.
        type: boolean
      lastModifiedTime:
        description: Gets or sets the last modified time of the runbook draft.
        format: date-time
        type: string
        x-nullable: false
      outputTypes:
        description: Gets or sets the runbook output types.
        items:
          type: string
        type: array
      parameters:
        additionalProperties:
          $ref: "#/definitions/RunbookParameter"
        description: Gets or sets the runbook draft parameters.
        type: object
  RunbookDraftUndoEditResult:
    description: The response model for the undo edit runbook operation.
    properties:
      requestId:
        type: string
      statusCode:
        enum:
          - Continue
          - SwitchingProtocols
          - OK
          - Created
          - Accepted
          - NonAuthoritativeInformation
          - NoContent
          - ResetContent
          - PartialContent
          - MultipleChoices
          - Ambiguous
          - MovedPermanently
          - Moved
          - Found
          - Redirect
          - SeeOther
          - RedirectMethod
          - NotModified
          - UseProxy
          - Unused
          - TemporaryRedirect
          - RedirectKeepVerb
          - BadRequest
          - Unauthorized
          - PaymentRequired
          - Forbidden
          - NotFound
          - MethodNotAllowed
          - NotAcceptable
          - ProxyAuthenticationRequired
          - RequestTimeout
          - Conflict
          - Gone
          - LengthRequired
          - PreconditionFailed
          - RequestEntityTooLarge
          - RequestUriTooLong
          - UnsupportedMediaType
          - RequestedRangeNotSatisfiable
          - ExpectationFailed
          - UpgradeRequired
          - InternalServerError
          - NotImplemented
          - BadGateway
          - ServiceUnavailable
          - GatewayTimeout
          - HttpVersionNotSupported
        type: string
        x-ms-enum:
          modelAsString: true
          name: HttpStatusCode
  RunbookListResult:
    description: The response model for the list runbook operation.
    properties:
      nextLink:
        description: Gets or sets the next link.
        type: string
      value:
        description: Gets or sets a list of runbooks.
        items:
          $ref: "#/definitions/Runbook"
        type: array
  RunbookParameter:
    description: Definition of the runbook parameter type.
    properties:
      defaultValue:
        description: Gets or sets the default value of parameter.
        type: string
      isMandatory:
        description: Gets or sets a Boolean value to indicate whether the parameter is mandatory or not.
        type: boolean
      position:
        description: Get or sets the position of the parameter.
        format: int32
        type: integer
      type:
        description: Gets or sets the type of the parameter.
        type: string
  RunbookProperties:
    description: Definition of the runbook property type.
    properties:
      creationTime:
        description: Gets or sets the creation time.
        format: date-time
        type: string
        x-nullable: false
      description:
        description: Gets or sets the description.
        type: string
      draft:
        $ref: "#/definitions/RunbookDraft"
        description: Gets or sets the draft runbook properties.
      jobCount:
        description: Gets or sets the job count of the runbook.
        format: int32
        type: integer
      lastModifiedBy:
        description: Gets or sets the last modified by.
        type: string
      lastModifiedTime:
        description: Gets or sets the last modified time.
        format: date-time
        type: string
        x-nullable: false
      logActivityTrace:
        description: Gets or sets the option to log activity trace of the runbook.
        format: int32
        type: integer
      logProgress:
        description: Gets or sets progress log option.
        type: boolean
      logVerbose:
        description: Gets or sets verbose log option.
        type: boolean
      outputTypes:
        description: Gets or sets the runbook output types.
        items:
          type: string
        type: array
      parameters:
        additionalProperties:
          $ref: "#/definitions/RunbookParameter"
        description: Gets or sets the runbook parameters.
        type: object
      provisioningState:
        description: Gets or sets the provisioning state of the runbook.
        enum:
          - Succeeded
        type: string
        x-ms-enum:
          modelAsString: false
          name: RunbookProvisioningState
      publishContentLink:
        $ref: "#/definitions/ContentLink"
        description: Gets or sets the published runbook content link.
      runbookType:
        description: Gets or sets the type of the runbook.
        enum:
          - Script
          - Graph
          - PowerShellWorkflow
          - PowerShell
          - GraphPowerShellWorkflow
          - GraphPowerShell
        type: string
        x-ms-enum:
          modelAsString: true
          name: RunbookTypeEnum
      state:
        description: Gets or sets the state of the runbook.
        enum:
          - New
          - Edit
          - Published
        type: string
        x-ms-enum:
          modelAsString: true
          name: RunbookState
  RunbookUpdateParameters:
    description: The parameters supplied to the update runbook operation.
    properties:
      location:
        description: Gets or sets the location of the resource.
        type: string
      name:
        description: Gets or sets the name of the resource.
        type: string
      properties:
        $ref: "#/definitions/RunbookUpdateProperties"
        description: Gets or sets the runbook update properties.
        x-ms-client-flatten: true
      tags:
        additionalProperties:
          type: string
        description: Gets or sets the tags attached to the resource.
        type: object
  RunbookUpdateProperties:
    description: The parameters supplied to the update runbook properties.
    properties:
      description:
        description: Gets or sets the description of the runbook.
        type: string
      logActivityTrace:
        description: Gets or sets the activity-level tracing options of the runbook.
        format: int32
        type: integer
      logProgress:
        description: Gets or sets progress log option.
        type: boolean
      logVerbose:
        description: Gets or sets verbose log option.
        type: boolean
  TestJob:
    description: Definition of the test job.
    properties:
      creationTime:
        description: Gets or sets the creation time of the test job.
        format: date-time
        type: string
        x-nullable: false
      endTime:
        description: Gets or sets the end time of the test job.
        format: date-time
        type: string
        x-nullable: true
      exception:
        description: Gets or sets the exception of the test job.
        type: string
      lastModifiedTime:
        description: Gets or sets the last modified time of the test job.
        format: date-time
        type: string
        x-nullable: false
      lastStatusModifiedTime:
        description: Gets or sets the last status modified time of the test job.
        format: date-time
        type: string
        x-nullable: true
      logActivityTrace:
        description: The activity-level tracing options of the runbook.
        format: int32
        type: integer
      parameters:
        additionalProperties:
          type: string
        description: Gets or sets the parameters of the test job.
        type: object
      runOn:
        description: Gets or sets the runOn which specifies the group name where the job is to be executed.
        type: string
      startTime:
        description: Gets or sets the start time of the test job.
        format: date-time
        type: string
        x-nullable: true
      status:
        description: Gets or sets the status of the test job.
        type: string
      statusDetails:
        description: Gets or sets the status details of the test job.
        type: string
    x-ms-mutability:
      - read
      - create
  TestJobCreateParameters:
    description: The parameters supplied to the create test job operation.
    properties:
      parameters:
        additionalProperties:
          type: string
        description: Gets or sets the parameters of the test job.
        type: object
      runOn:
        description: Gets or sets the runOn which specifies the group name where the job is to be executed.
        type: string
