{
  "swagger": "2.0",
  "schemes": [
    "https"
  ],
  "host": "management.azure.com",
  "info": {
    "description": "The Run Commands Client.",
    "title": "RunCommandsClient",
    "version": "2017-03-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/compute/resource-manager/Microsoft.Compute/stable/2017-03-30/runCommands.json",
        "version": "2.0"
      }
    ],
    "x-preferred": false,
    "x-providerName": "azure.com",
    "x-serviceName": "compute-runCommands",
    "x-tags": [
      "Azure",
      "Microsoft"
    ]
  },
  "consumes": [
    "application/json",
    "text/json"
  ],
  "produces": [
    "application/json",
    "text/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": {
    "ApiVersionParameter": {
      "description": "Client Api Version.",
      "in": "query",
      "name": "api-version",
      "required": true,
      "type": "string"
    },
    "SubscriptionIdParameter": {
      "description": "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"
    }
  },
  "paths": {
    "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands": {
      "get": {
        "description": "Lists all available run commands for a subscription in a location.",
        "operationId": "VirtualMachineRunCommands_List",
        "parameters": [
          {
            "description": "The location upon which run commands is queried.",
            "in": "path",
            "name": "location",
            "pattern": "^[-\\w\\._]+$",
            "required": true,
            "type": "string"
          },
          {
            "$ref": "#/parameters/ApiVersionParameter"
          },
          {
            "$ref": "#/parameters/SubscriptionIdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/RunCommandListResult"
            }
          }
        },
        "tags": [
          "VirtualMachineRunCommands"
        ],
        "x-ms-examples": {
          "VirtualMachineRunCommandList": {
            "parameters": {
              "api-version": "2017-03-30",
              "location": "SoutheastAsia",
              "subscriptionId": "subid"
            },
            "responses": {
              "200": {
                "body": {
                  "value": [
                    {
                      "$schema": "http://schema.management.azure.com/schemas/2016-11-17/runcommands.json",
                      "description": "Configure the machine to enable remote powershell.",
                      "id": "EnableRemotePS",
                      "label": "Enable remote PowerShell",
                      "osType": "Windows"
                    },
                    {
                      "$schema": "http://schema.management.azure.com/schemas/2016-11-17/runcommands.json",
                      "description": "List detailed information for the RDP settings: port number, domain profile, etc. and optionally reset the RDP.",
                      "id": "GetRDP",
                      "label": "RDP configuration",
                      "osType": "Windows"
                    },
                    {
                      "$schema": "http://schema.management.azure.com/schemas/2016-11-17/runcommands.json",
                      "description": "Shows detailed information for the IP address, subnet mask and default gateway for each adapter bound to TCP/IP.",
                      "id": "IPConfig",
                      "label": "List IP configuration",
                      "osType": "Windows"
                    },
                    {
                      "$schema": "http://schema.management.azure.com/schemas/2016-11-17/runcommands.json",
                      "description": "Executes a custom PowerShell script with optional parameters.",
                      "id": "PowerShellScript",
                      "label": "Executes a PowerShell script",
                      "osType": "Windows"
                    },
                    {
                      "$schema": "http://schema.management.azure.com/schemas/2016-11-17/runcommands.json",
                      "description": "Executes a custom script with optional parameters.",
                      "id": "CustomScriptForLinux",
                      "label": "Executes a Linux shell script",
                      "osType": "Linux"
                    },
                    {
                      "$schema": "http://schema.management.azure.com/schemas/2016-11-17/runcommands.json",
                      "description": "Get the configuration of all network interfaces.",
                      "id": "ifconfig",
                      "label": "List network configuration",
                      "osType": "Linux"
                    }
                  ]
                }
              }
            }
          }
        },
        "x-ms-pageable": {
          "nextLinkName": "nextLink"
        }
      }
    },
    "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}": {
      "get": {
        "description": "Gets specific run command for a subscription in a location.",
        "operationId": "VirtualMachineRunCommands_Get",
        "parameters": [
          {
            "description": "The location upon which run commands is queried.",
            "in": "path",
            "name": "location",
            "pattern": "^[-\\w\\._]+$",
            "required": true,
            "type": "string"
          },
          {
            "description": "The command id.",
            "in": "path",
            "name": "commandId",
            "required": true,
            "type": "string"
          },
          {
            "$ref": "#/parameters/ApiVersionParameter"
          },
          {
            "$ref": "#/parameters/SubscriptionIdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/RunCommandDocument"
            }
          }
        },
        "tags": [
          "VirtualMachineRunCommands"
        ],
        "x-ms-examples": {
          "VirtualMachineRunCommandGet": {
            "parameters": {
              "api-version": "2017-03-30",
              "commandId": "PowerShellScript",
              "location": "SoutheastAsia",
              "subscriptionId": "24fb23e3-6ba3-41f0-9b6e-e41131d5d61e"
            },
            "responses": {
              "200": {
                "body": {
                  "$schema": "http://schema.management.azure.com/schemas/2016-11-17/runcommands.json",
                  "description": "Executes a custom PowerShell script with optional parameters.",
                  "id": "PowerShellScript",
                  "label": "Executes a PowerShell script",
                  "osType": "Windows",
                  "parameters": [
                    {
                      "name": "customScript",
                      "required": true,
                      "type": "string"
                    },
                    {
                      "name": "customParameters",
                      "required": false,
                      "type": "string"
                    }
                  ],
                  "script": [
                    "param(",
                    "  [string]$customScript,",
                    "  [string]$customParameters",
                    ")",
                    "$scriptBlock = [Scriptblock]::Create(\".{$customScript} $(&{$args} $customParameters)\")",
                    "Invoke-Command $scriptBlock"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand": {
      "post": {
        "description": "Run command on the VM.",
        "operationId": "VirtualMachines_RunCommand",
        "parameters": [
          {
            "description": "The name of the resource group.",
            "in": "path",
            "name": "resourceGroupName",
            "required": true,
            "type": "string"
          },
          {
            "description": "The name of the virtual machine.",
            "in": "path",
            "name": "vmName",
            "required": true,
            "type": "string"
          },
          {
            "description": "Parameters supplied to the Run command operation.",
            "in": "body",
            "name": "parameters",
            "required": true,
            "schema": {
              "$ref": "#/definitions/RunCommandInput"
            }
          },
          {
            "$ref": "#/parameters/ApiVersionParameter"
          },
          {
            "$ref": "#/parameters/SubscriptionIdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/RunCommandResult"
            }
          },
          "202": {
            "description": "Accepted"
          }
        },
        "tags": [
          "VirtualMachines"
        ],
        "x-ms-examples": {
          "VirtualMachineRunCommand": {
            "parameters": {
              "$top": 1,
              "api-version": "2017-03-30",
              "monitor": "true",
              "parameters": {
                "commandId": "ipconfig"
              },
              "resourceGroupName": "crptestar98131",
              "subscriptionId": "24fb23e3-6ba3-41f0-9b6e-e41131d5d61e",
              "vmName": "vm3036"
            },
            "responses": {
              "200": {
                "body": {
                  "endTime": "2017-06-16T16:10:11.2897717-07:00",
                  "name": "289dbc84-3c84-4a86-9e40-bbd4d61edcaf",
                  "properties": {
                    "output": [
                      {
                        "code": "ComponentStatus/StdOut/succeeded",
                        "displayStatus": "Provisioning succeeded",
                        "level": "Info",
                        "message": "This is a sample script with parameters value1 value2"
                      },
                      {
                        "code": "ComponentStatus/StdErr/succeeded",
                        "displayStatus": "Provisioning succeeded",
                        "level": "Info",
                        "message": "#< CLIXML \n<Objs Version=\"1.1.0.1\" xmlns=\"http://schemas.microsoft.com/powershell/2004/04\"><Obj S=\"progress\" RefId=\"0\"><TN RefId=\"0\"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64 N=\"SourceId\">1</I64><PR N=\"Record\"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj><Obj S=\"progress\" RefId=\"1\"><TNRef RefId=\"0\" /><MS><I64 N=\"SourceId\">2</I64><PR N=\"Record\"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj><Obj S=\"progress\" RefId=\"2\"><TNRef RefId=\"0\" /><MS><I64 N=\"SourceId\">3</I64><PR N=\"Record\"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj></Objs>"
                      }
                    ]
                  },
                  "startTime": "2017-06-16T16:01:37.8958419-07:00",
                  "status": "Succeeded"
                }
              },
              "202": {}
            }
          }
        },
        "x-ms-long-running-operation": true,
        "x-ms-long-running-operation-options": {
          "final-state-via": "azure-async-operation"
        }
      }
    }
  },
  "definitions": {
    "ApiError": {
      "description": "Api error.",
      "properties": {
        "code": {
          "description": "The error code.",
          "type": "string"
        },
        "details": {
          "description": "The Api error details",
          "items": {
            "$ref": "#/definitions/ApiErrorBase"
          },
          "type": "array"
        },
        "innererror": {
          "$ref": "#/definitions/InnerError",
          "description": "The Api inner error"
        },
        "message": {
          "description": "The error message.",
          "type": "string"
        },
        "target": {
          "description": "The target of the particular error.",
          "type": "string"
        }
      }
    },
    "ApiErrorBase": {
      "description": "Api error base.",
      "properties": {
        "code": {
          "description": "The error code.",
          "type": "string"
        },
        "message": {
          "description": "The error message.",
          "type": "string"
        },
        "target": {
          "description": "The target of the particular error.",
          "type": "string"
        }
      }
    },
    "InnerError": {
      "description": "Inner error details.",
      "properties": {
        "errordetail": {
          "description": "The internal error message or exception dump.",
          "type": "string"
        },
        "exceptiontype": {
          "description": "The exception type.",
          "type": "string"
        }
      }
    },
    "OperationStatusResponse": {
      "description": "Operation status response",
      "properties": {
        "endTime": {
          "description": "End time of the operation",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "error": {
          "$ref": "#/definitions/ApiError",
          "description": "Api error",
          "readOnly": true
        },
        "name": {
          "description": "Operation ID",
          "readOnly": true,
          "type": "string"
        },
        "startTime": {
          "description": "Start time of the operation",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "status": {
          "description": "Operation status",
          "readOnly": true,
          "type": "string"
        }
      }
    },
    "RunCommandDocument": {
      "allOf": [
        {
          "$ref": "#/definitions/RunCommandDocumentBase"
        }
      ],
      "description": "Describes the properties of a Run Command.",
      "properties": {
        "parameters": {
          "description": "The parameters used by the script.",
          "items": {
            "$ref": "#/definitions/RunCommandParameterDefinition"
          },
          "type": "array"
        },
        "script": {
          "description": "The script to be executed.",
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "required": [
        "script"
      ]
    },
    "RunCommandDocumentBase": {
      "description": "Describes the properties of a Run Command metadata.",
      "properties": {
        "$schema": {
          "description": "The VM run command schema.",
          "type": "string"
        },
        "description": {
          "description": "The VM run command description.",
          "type": "string"
        },
        "id": {
          "description": "The VM run command id.",
          "type": "string"
        },
        "label": {
          "description": "The VM run command label.",
          "type": "string"
        },
        "osType": {
          "description": "The Operating System type.",
          "enum": [
            "Windows",
            "Linux"
          ],
          "type": "string",
          "x-ms-enum": {
            "modelAsString": false,
            "name": "OperatingSystemTypes"
          }
        }
      },
      "required": [
        "$schema",
        "id",
        "osType",
        "label",
        "description"
      ]
    },
    "RunCommandInput": {
      "description": "Capture Virtual Machine parameters.",
      "properties": {
        "commandId": {
          "description": "The run command id.",
          "type": "string"
        },
        "parameters": {
          "description": "The run command parameters.",
          "items": {
            "$ref": "#/definitions/RunCommandInputParameter"
          },
          "type": "array"
        },
        "script": {
          "description": "Optional. The script to be executed.  When this value is given, the given script will override the default script of the command.",
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "required": [
        "commandId"
      ]
    },
    "RunCommandInputParameter": {
      "description": "Describes the properties of a run command parameter.",
      "properties": {
        "name": {
          "description": "The run command parameter name.",
          "type": "string"
        },
        "value": {
          "description": "The run command parameter value.",
          "type": "string"
        }
      },
      "required": [
        "name",
        "value"
      ]
    },
    "RunCommandListResult": {
      "description": "The List Virtual Machine operation response.",
      "properties": {
        "nextLink": {
          "description": "The uri to fetch the next page of run commands. Call ListNext() with this to fetch the next page of run commands.",
          "type": "string"
        },
        "value": {
          "description": "The list of virtual machine run commands.",
          "items": {
            "$ref": "#/definitions/RunCommandDocumentBase"
          },
          "type": "array"
        }
      },
      "required": [
        "value"
      ]
    },
    "RunCommandParameterDefinition": {
      "description": "Describes the properties of a run command parameter.",
      "properties": {
        "defaultValue": {
          "description": "The run command parameter default value.",
          "type": "string"
        },
        "name": {
          "description": "The run command parameter name.",
          "type": "string"
        },
        "required": {
          "default": false,
          "description": "The run command parameter required.",
          "type": "boolean"
        },
        "type": {
          "description": "The run command parameter type.",
          "type": "string"
        }
      },
      "required": [
        "name",
        "type"
      ]
    },
    "RunCommandResult": {
      "allOf": [
        {
          "$ref": "#/definitions/OperationStatusResponse"
        }
      ],
      "description": "Run command operation response.",
      "properties": {
        "properties": {
          "$ref": "#/definitions/RunCommandResultProperties",
          "x-ms-client-flatten": true
        }
      }
    },
    "RunCommandResultProperties": {
      "description": "Compute-specific operation properties, including output",
      "properties": {
        "output": {
          "description": "Operation output data (raw JSON)",
          "type": "object"
        }
      }
    }
  }
}