Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Commands/vm/_list-usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# [Command] _vm list-usage_

List available usage resources for VMs.

## Versions

### [2024-11-01](/Resources/mgmt-plane/L3N1YnNjcmlwdGlvbnMve30vcHJvdmlkZXJzL21pY3Jvc29mdC5jb21wdXRlL2xvY2F0aW9ucy97fS91c2FnZXM=/2024-11-01.xml) **Stable**

<!-- mgmt-plane /subscriptions/{}/providers/microsoft.compute/locations/{}/usages 2024-11-01 -->

#### examples

- Get the compute resource usage for the West US region.
```bash
vm list-usage -l westus
```
28 changes: 28 additions & 0 deletions Commands/vm/_stop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# [Command] _vm stop_

Power off (stop) a running VM.

The VM will continue to be billed. To avoid this, you can deallocate the VM through "az vm deallocate".

## Versions

### [2024-11-01](/Resources/mgmt-plane/L3N1YnNjcmlwdGlvbnMve30vcmVzb3VyY2Vncm91cHMve30vcHJvdmlkZXJzL21pY3Jvc29mdC5jb21wdXRlL3ZpcnR1YWxtYWNoaW5lcy97fS9wb3dlcm9mZg==/2024-11-01.xml) **Stable**

<!-- mgmt-plane /subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/poweroff 2024-11-01 -->

#### examples

- Power off (stop) a running VM.
```bash
vm stop --resource-group MyResourceGroup --name MyVm
```

- Power off a running VM without shutting down.
```bash
vm stop --resource-group MyResourceGroup --name MyVm --skip-shutdown
```

- Power off VMs in a resource group.
```bash
vm stop --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv)
```
6 changes: 6 additions & 0 deletions Commands/vm/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ Manage Linux or Windows virtual machines.
- [list-skus](/Commands/vm/_list-skus.md)
: Get details for compute-related resource SKUs.

- [list-usage](/Commands/vm/_list-usage.md)
: List available usage resources for VMs.

- [list-vm-resize-options](/Commands/vm/_list-vm-resize-options.md)
: List available resizing options for VMs.

Expand Down Expand Up @@ -93,6 +96,9 @@ Manage Linux or Windows virtual machines.
- [start](/Commands/vm/_start.md)
: Start a stopped VM.

- [stop](/Commands/vm/_stop.md)
: Power off (stop) a running VM.

- [update](/Commands/vm/_update.md)
: Update operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"plane": "mgmt-plane", "resources": [{"id": "/subscriptions/{}/providers/microsoft.compute/locations/{}/usages", "version": "2024-11-01", "swagger": "mgmt-plane/compute/ResourceProviders/Microsoft.Compute/Paths/L3N1YnNjcmlwdGlvbnMve3N1YnNjcmlwdGlvbklkfS9wcm92aWRlcnMvTWljcm9zb2Z0LkNvbXB1dGUvbG9jYXRpb25zL3tsb2NhdGlvbn0vdXNhZ2Vz/V/MjAyNC0xMS0wMQ=="}], "commandGroups": [{"name": "vm", "commands": [{"name": "list-usage", "version": "2024-11-01", "resources": [{"id": "/subscriptions/{}/providers/microsoft.compute/locations/{}/usages", "version": "2024-11-01", "swagger": "mgmt-plane/compute/ResourceProviders/Microsoft.Compute/Paths/L3N1YnNjcmlwdGlvbnMve3N1YnNjcmlwdGlvbklkfS9wcm92aWRlcnMvTWljcm9zb2Z0LkNvbXB1dGUvbG9jYXRpb25zL3tsb2NhdGlvbn0vdXNhZ2Vz/V/MjAyNC0xMS0wMQ=="}], "argGroups": [{"name": "", "args": [{"type": "ResourceLocation", "var": "$Path.location", "options": ["l", "location"], "required": true, "group": "", "idPart": "name", "help": {"short": "Location. Values from: `az account list-locations`. You can configure the default location using `az configure --defaults location=<location>`."}}, {"type": "SubscriptionId", "var": "$Path.subscriptionId", "options": ["subscription"], "required": true, "idPart": "subscription"}]}], "operations": [{"operationId": "Usage_List", "http": {"path": "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages", "request": {"method": "get", "path": {"params": [{"type": "string", "name": "location", "arg": "$Path.location", "required": true, "format": {"minLength": 1}}, {"type": "string", "name": "subscriptionId", "arg": "$Path.subscriptionId", "required": true, "format": {"minLength": 1}}]}, "query": {"consts": [{"readOnly": true, "const": true, "default": {"value": "2024-11-01"}, "type": "string", "name": "api-version", "required": true, "format": {"minLength": 1}}]}}, "responses": [{"statusCode": [200], "body": {"json": {"var": "$Instance", "schema": {"type": "object", "props": [{"type": "string", "name": "nextLink"}, {"type": "array<object>", "name": "value", "required": true, "item": {"type": "object", "props": [{"type": "integer32", "name": "currentValue", "required": true}, {"type": "integer64", "name": "limit", "required": true}, {"type": "object", "name": "name", "required": true, "props": [{"type": "string", "name": "localizedValue"}, {"type": "string", "name": "value"}]}, {"type": "string", "name": "unit", "required": true, "enum": {"items": [{"value": "Count"}]}}]}}]}}}}, {"isError": true, "body": {"json": {"schema": {"type": "@ODataV4Format"}}}}]}}], "outputs": [{"type": "array", "ref": "$Instance.value", "clientFlatten": true, "nextLink": "$Instance.nextLink"}], "confirmation": ""}]}]}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version='1.0' encoding='utf-8'?>
<CodeGen plane="mgmt-plane">
<resource id="/subscriptions/{}/providers/microsoft.compute/locations/{}/usages" version="2024-11-01" swagger="mgmt-plane/compute/ResourceProviders/Microsoft.Compute/Paths/L3N1YnNjcmlwdGlvbnMve3N1YnNjcmlwdGlvbklkfS9wcm92aWRlcnMvTWljcm9zb2Z0LkNvbXB1dGUvbG9jYXRpb25zL3tsb2NhdGlvbn0vdXNhZ2Vz/V/MjAyNC0xMS0wMQ=="/>
<commandGroup name="vm">
<command name="list-usage" version="2024-11-01" confirmation="">
<resource id="/subscriptions/{}/providers/microsoft.compute/locations/{}/usages" version="2024-11-01" swagger="mgmt-plane/compute/ResourceProviders/Microsoft.Compute/Paths/L3N1YnNjcmlwdGlvbnMve3N1YnNjcmlwdGlvbklkfS9wcm92aWRlcnMvTWljcm9zb2Z0LkNvbXB1dGUvbG9jYXRpb25zL3tsb2NhdGlvbn0vdXNhZ2Vz/V/MjAyNC0xMS0wMQ=="/>
<argGroup name="">
<arg type="ResourceLocation" var="$Path.location" options="location l" required="True" group="" idPart="name">
<help short="Location. Values from: `az account list-locations`. You can configure the default location using `az configure --defaults location=<location>`."/>
</arg>
<arg type="SubscriptionId" var="$Path.subscriptionId" options="subscription" required="True" idPart="subscription"/>
</argGroup>
<operation operationId="Usage_List">
<http path="/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages">
<request method="get">
<path>
<param type="string" name="location" arg="$Path.location" required="True">
<format minLength="1"/>
</param>
<param type="string" name="subscriptionId" arg="$Path.subscriptionId" required="True">
<format minLength="1"/>
</param>
</path>
<query>
<const readOnly="True" const="True" type="string" name="api-version" required="True">
<default value="&quot;2024-11-01&quot;"/>
<format minLength="1"/>
</const>
</query>
</request>
<response statusCode="200">
<body>
<json var="$Instance">
<schema type="object">
<prop type="string" name="nextLink"/>
<prop type="array<object>" name="value" required="True">
<item type="object">
<prop type="integer32" name="currentValue" required="True"/>
<prop type="integer64" name="limit" required="True"/>
<prop type="object" name="name" required="True">
<prop type="string" name="localizedValue"/>
<prop type="string" name="value"/>
</prop>
<prop type="string" name="unit" required="True">
<enum>
<item value="&quot;Count&quot;"/>
</enum>
</prop>
</item>
</prop>
</schema>
</json>
</body>
</response>
<response isError="True">
<body>
<json>
<schema type="@ODataV4Format"/>
</json>
</body>
</response>
</http>
</operation>
<output type="array" ref="$Instance.value" clientFlatten="True" nextLink="$Instance.nextLink"/>
</command>
</commandGroup>
</CodeGen>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"plane": "mgmt-plane", "resources": [{"id": "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/poweroff", "version": "2024-11-01", "swagger": "mgmt-plane/compute/ResourceProviders/Microsoft.Compute/Paths/L3N1YnNjcmlwdGlvbnMve3N1YnNjcmlwdGlvbklkfS9yZXNvdXJjZUdyb3Vwcy97cmVzb3VyY2VHcm91cE5hbWV9L3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS92aXJ0dWFsTWFjaGluZXMve3ZtTmFtZX0vcG93ZXJPZmY=/V/MjAyNC0xMS0wMQ=="}], "commandGroups": [{"name": "vm", "commands": [{"name": "stop", "version": "2024-11-01", "resources": [{"id": "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/poweroff", "version": "2024-11-01", "swagger": "mgmt-plane/compute/ResourceProviders/Microsoft.Compute/Paths/L3N1YnNjcmlwdGlvbnMve3N1YnNjcmlwdGlvbklkfS9yZXNvdXJjZUdyb3Vwcy97cmVzb3VyY2VHcm91cE5hbWV9L3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS92aXJ0dWFsTWFjaGluZXMve3ZtTmFtZX0vcG93ZXJPZmY=/V/MjAyNC0xMS0wMQ=="}], "argGroups": [{"name": "", "args": [{"type": "ResourceGroupName", "var": "$Path.resourceGroupName", "options": ["g", "resource-group"], "required": true, "idPart": "resource_group"}, {"type": "SubscriptionId", "var": "$Path.subscriptionId", "options": ["subscription"], "required": true, "idPart": "subscription"}, {"type": "string", "var": "$Path.vmName", "options": ["n", "name"], "required": true, "group": "", "idPart": "name", "help": {"short": "The name of the virtual machine."}}, {"type": "boolean", "var": "$Query.skipShutdown", "options": ["skip-shutdown"], "help": {"short": "The parameter to request non-graceful VM shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not specified"}}]}], "operations": [{"longRunning": {"finalStateVia": "location"}, "operationId": "VirtualMachines_PowerOff", "http": {"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff", "request": {"method": "post", "path": {"params": [{"type": "string", "name": "resourceGroupName", "arg": "$Path.resourceGroupName", "required": true, "format": {"maxLength": 90, "minLength": 1}}, {"type": "string", "name": "subscriptionId", "arg": "$Path.subscriptionId", "required": true, "format": {"minLength": 1}}, {"type": "string", "name": "vmName", "arg": "$Path.vmName", "required": true}]}, "query": {"params": [{"type": "boolean", "name": "skipShutdown", "arg": "$Query.skipShutdown"}], "consts": [{"readOnly": true, "const": true, "default": {"value": "2024-11-01"}, "type": "string", "name": "api-version", "required": true, "format": {"minLength": 1}}]}}, "responses": [{"statusCode": [200]}, {"statusCode": [202], "header": {"items": [{"name": "Location"}, {"name": "Retry-After"}]}}, {"isError": true, "body": {"json": {"schema": {"type": "@ODataV4Format"}}}}]}}], "confirmation": ""}]}]}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version='1.0' encoding='utf-8'?>
<CodeGen plane="mgmt-plane">
<resource id="/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/poweroff" version="2024-11-01" swagger="mgmt-plane/compute/ResourceProviders/Microsoft.Compute/Paths/L3N1YnNjcmlwdGlvbnMve3N1YnNjcmlwdGlvbklkfS9yZXNvdXJjZUdyb3Vwcy97cmVzb3VyY2VHcm91cE5hbWV9L3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS92aXJ0dWFsTWFjaGluZXMve3ZtTmFtZX0vcG93ZXJPZmY=/V/MjAyNC0xMS0wMQ=="/>
<commandGroup name="vm">
<command name="stop" version="2024-11-01" confirmation="">
<resource id="/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/poweroff" version="2024-11-01" swagger="mgmt-plane/compute/ResourceProviders/Microsoft.Compute/Paths/L3N1YnNjcmlwdGlvbnMve3N1YnNjcmlwdGlvbklkfS9yZXNvdXJjZUdyb3Vwcy97cmVzb3VyY2VHcm91cE5hbWV9L3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS92aXJ0dWFsTWFjaGluZXMve3ZtTmFtZX0vcG93ZXJPZmY=/V/MjAyNC0xMS0wMQ=="/>
<argGroup name="">
<arg type="ResourceGroupName" var="$Path.resourceGroupName" options="resource-group g" required="True" idPart="resource_group"/>
<arg type="SubscriptionId" var="$Path.subscriptionId" options="subscription" required="True" idPart="subscription"/>
<arg type="string" var="$Path.vmName" options="name n" required="True" group="" idPart="name">
<help short="The name of the virtual machine."/>
</arg>
<arg type="boolean" var="$Query.skipShutdown" options="skip-shutdown">
<help short="The parameter to request non-graceful VM shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not specified"/>
</arg>
</argGroup>
<operation operationId="VirtualMachines_PowerOff">
<longRunning finalStateVia="location"/>
<http path="/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff">
<request method="post">
<path>
<param type="string" name="resourceGroupName" arg="$Path.resourceGroupName" required="True">
<format maxLength="90" minLength="1"/>
</param>
<param type="string" name="subscriptionId" arg="$Path.subscriptionId" required="True">
<format minLength="1"/>
</param>
<param type="string" name="vmName" arg="$Path.vmName" required="True"/>
</path>
<query>
<param type="boolean" name="skipShutdown" arg="$Query.skipShutdown"/>
<const readOnly="True" const="True" type="string" name="api-version" required="True">
<default value="&quot;2024-11-01&quot;"/>
<format minLength="1"/>
</const>
</query>
</request>
<response statusCode="200"/>
<response statusCode="202">
<header>
<item name="Location"/>
<item name="Retry-After"/>
</header>
</response>
<response isError="True">
<body>
<json>
<schema type="@ODataV4Format"/>
</json>
</body>
</response>
</http>
</operation>
</command>
</commandGroup>
</CodeGen>