azure-cli
Version:
Microsoft Azure Cross Platform Command Line tool
567 lines (154 loc) • 85.7 kB
JavaScript
/*** Generated by streamline 0.10.17 (callbacks) - DO NOT EDIT ***/ "use strict"; var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename, false),__func=__rt.__func,__cb=__rt.__cb; var util = require("util");
var utils = require("../../../util/utils");
var VMClient = require("./vmClient");
var vmConstants = require("../../../util/vmConstants");
var $ = utils.getLocaleString;
exports.init = function(cli) {
var vm = cli.category("vm").description($("Commands to manage your virtual machines"));
vm.command("create [resource-group] [name] [location] [os-type]").description($("Create a virtual machine in a resource group")).usage("[options] <resource-group> <name> <location> <os-type>").option("-g, --resource-group <resource-group>", $("the resource group name")).option("-n, --name <name>", $("the virtual machine name")).option("-D, --nic-id <nic-id>", $(("the NIC identifier" + "\n e.g. /subscriptions/<subscriptipn-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Network/networkInterfaces/<nic-name>"))).option("-f, --nic-name <nic-name>", $(((((("the NIC name" + "\n If this is an existing NIC then it must exists under the current resource group identified by resource-group") + "\n A new NIC will be created if no NIC exists with name nic-name in the current resource group") + "\n To create new NIC - subnet-id or vnet-name, vnet-address-prefix, subnet-name and vnet-subnet-address-prefix are required") + "\n Please use nic-id to refer an existing NIC in a different resource group") + "\n The parameter nic-name will be ignored when nic-id is specified"))).option("-I, --nic-ids <nic-ids>", $("the list of NIC identifiers separated by comma. In case of specifying multiple nics first one will be set as primary.")).option("-N, --nic-names <nic-names>", $((("the list of NIC names separated by comma. In case of specifying multiple nics first one will be set as primary." + "These NICs must exists in the same resource group as the VM. Please use nic-ids if that not the case. ") + "This parameter will be ignored if --nic-ids is specified"))).option("-l, --location <location>", $("the location")).option("-y, --os-type <os-type>", $("the operating system Type, valid values are Windows, Linux")).option("-Q, --image-urn <image-urn>", $(((((((("the image URN in the form publisherName:offer:skus:version.\n" + " URN Aliases:\n") + " ") + (utils.getImageAliasList().join("\n "))) + "\n") + "\n Or the source VHD link of a user image, e.g. https://foo.blob.core.windows.net/system/Microsoft.Compute/Images/vhds/snap-bar.vhd") + "\n Option '-d' can be used with this option to specify the destination storage location where the new OS VHD will be created and put to.") + "\n In this case, OS profile credentials have to be specified, i.e. user name/password, or SSH keys, etc."))).option("-u, --admin-username <admin-username>", $(("the user name" + "\n This parameter is valid for a VM created from an image (image-urn) and ignored when VM is based on an existing disk"))).option("-p, --admin-password <admin-password>", $(("the password" + "\n This parameter is valid for a VM created from an image (image-urn) and ignored when VM is based on existing disk"))).option("-M, --ssh-publickey-file <openssh-rsa-file|pem-file>", $(("path to public key PEM file or SSH Public key file for SSH authentication" + "\n This parameter is valid only when os-type is \"Linux\""))).option("-G, --generate-ssh-keys", $("Auto generate SSH keys, will be ignored if --ssh-publickey-file is specified. This parameter is valid only when os-type is \"Linux\"")).option("-z, --vm-size <vm-size>", $("the virtual machine size [Standard_DS1]")).option("-U, --public-ip-id <public-ip-id>", $(("the public ip identifier" + "\n e.g. /subscriptions/<subscriptipn-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Network/publicIPAddresses/<public-ip-name>"))).option("-i, --public-ip-name <public-ip-name>", $((((("the public ip name" + "\n If this is an existing public IP then it must exists under the current resource group identified by resource-group") + "\n A new public IP will be created if no public IP exists with name public-ip-name in the current resource group") + "\n Please use public-ip-id to refer an existing public IP in a different resource group") + "\n The parameter public-ip-name will be ignored when public-ip-id is specified"))).option("-w, --public-ip-domain-name <public-ip-domain-name>", $((("the public ip domain name" + "\n This sets the DNS to <publicip-domain-name>.<location>.cloudapp.azure.com") + "\n This parameter will be used only when creating new public IP"))).option("-m, --public-ip-allocation-method <public-ip-allocation-method>", $(("the public ip allocation method, valid values are \"Dynamic\"" + "\n This parameter will be used only when creating new public IP"))).option("-t, --public-ip-idletimeout <public-ip-idletimeout>", $(("the public ip idle timeout specified in minutes" + "\n This parameter will be used only when creating new public IP"))).option("-S, --subnet-id <subnet-id>", $(((("the subnet identifier" + "\n e.g. /subscriptions/<subscriptipn-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Network/virtualNetworks/<vnet-name>/subnets/<subnet-name>") + "\n Use this parameter if specified subnet exists only to avoid other vnet parameters to specify vnet and subnet you use") + "\n If you need to use subnet and virtual network from another resource group (not the same as VM resource group), just enter appropriate subnet ID"))).option("-F, --vnet-name <vnet-name>", $((((((((("the virtual network name" + "\n If this is an existing vnet then it must exists under the current resource group identified by resource-group") + "\n If this is an existing vnet then vnet-subnet-name is required") + "\n If no subnet exists with name vnet-subnet-name then a new subnet will be created") + "\n To create new subnet - vnet-subnet-address-prefix is required") + "\n A new vnet will be created if no vnet exists with name vnet-name in the current resource group") + "\n To create new vnet - vnet-address-prefix, vnet-subnet-name and vnet-subnet-address-prefix are required") + "\n Please use subnet-id to refer an existing subnet under a vnet in a different resource group") + "\n vnet-name, vnet-address-prefix, vnet-subnet-name and vnet-subnet-address-prefix will be ignored when subnet-id is specified"))).option("-P, --vnet-address-prefix <vnet-address-prefix>", $("the virtual network address prefix in IPv4/CIDR format")).option("-j, --vnet-subnet-name <vnet-subnet-name>", $("the virtual network subnet name")).option("-k, --vnet-subnet-address-prefix <vnet-subnet-address-prefix>", $("the virtual network subnet address prefix in IPv4/CIDR format")).option("-r, --availset-name <availset-name>", $("the availability set name")).option("-o, --storage-account-name <storage-account-name>", $("the storage account name")).option("--storage-account-type <storage-account-type>", $("the storage account type for to-be-generated storage account, default Premium_LRS")).option("-R, --storage-account-container-name <storage-account-container-name>", $("the storage account container name [vhds]")).option("-d, --os-disk-vhd <os-disk-vhd>", $(((("name or url of the OS disk Vhd" + "\n If this parameter is specified along with --image-urn ('-Q') parameter then OS disk created from the image will be stored in this vhd.") + "\n If this parameter is specified without --image-urn ('-Q') parameter then this vhd must exists and will be used as a specialized OS disk image.") + "\n If this parameter is specified without --image-urn ('-Q') parameter, OS profile credentials will be ignored, and the specialized credentials from the disk image will be used."))).option("-a, --data-disk-caching <data-disk-caching>", $("data disk caching, valid values are None, ReadOnly, ReadWrite")).option("-x, --data-disk-vhd <data-disk-vhd>", $("name or url of the data disk Vhd")).option("-e, --data-disk-size <data-disk-size>", $("data disk size in GB")).option("-Y, --data-disk-existing", $("Will use existing VHD if specified. Don't specify this param if you are creating data disk from a new VHD.")).option("-C, --custom-data <custom-data-file>", $("CustomData file")).option("-s, --subscription <subscription>", $("the subscription identifier")).option("--tags <tags>", $(("Tags to set to the virtual machine. Can be multiple. " + "In the format of 'name=value'. Name is required and value is optional. For example, --tags tag1=value1;tag2"))).option("--disable-boot-diagnostics", $("The switch parameter to disable the boot diagnostics (by default enabled) for VM.")).option("--boot-diagnostics-storage-uri <boot-diagnostics-storage-uri>", $(("Optional. Specify storage account URL for boot diagnostics. " + "In the format of 'https://your_stoage_account_name.blob.core.windows.net/'."))).option("--disable-bginfo-extension", $("The switch parameter to disable the BGInfo extension for VM.")).option("--disk-encryption-key-vault-id <disk-encryption-key-vault-id>", $("The OS disk encryption key vault ID.")).option("--disk-encryption-key-url <disk-encryption-key-url>", $("The OS disk encryption key secret URL.")).option("--key-encryption-key-vault-id <key-encryption-key-vault-id>", $("The vault reference Url for the OS disk encryption key.")).option("--key-encryption-key-url <key-encryption-key-url>", $("The Url of the master key used to encrypt the OS disk encryption key.")).option("--license-type <license-type>", $("The license type of the system; currently, only 'Windows_Sever' is supported.")).option("--plan-name <plan-name>", $("The plan name.")).option("--plan-publisher <plan-publisher-name>", $("The plan publisher ID.")).option("--plan-product <plan-product-name>", $("The plan product ID.")).option("--plan-promotion-code <plan-promotion-code>", $("The plan promotion code.")).execute(function __1(resourceGroup, name, location, osType, options, _) { var vmClient; var __frame = { name: "__1", line: 122 }; return __func(_, this, arguments, __1, 5, __frame, function __$__1() {
return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1;
return cli.interaction.promptIfNotGiven($("Virtual machine name: "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2;
return cli.interaction.promptIfNotGiven($("Location name: "), location, __cb(_, __frame, 3, 33, function ___(__0, __3) { location = __3;
return cli.interaction.promptIfNotGiven($("Operating system Type: "), osType, __cb(_, __frame, 4, 31, function ___(__0, __4) { osType = __4;
location = utils.toLowerCaseAndRemoveSpace(location);
if (((options.diskEncryptionKeyVaultId && !options.diskEncryptionKeyUrl) || (!options.diskEncryptionKeyVaultId && options.diskEncryptionKeyUrl))) {
return _(new Error($("Both --disk-encryption-key-vault-id and --disk-encryption-key-url have to be specified, or neither of them."))); } ;
if (((options.keyEncryptionKeyVaultId && !options.keyEncryptionKeyUrl) || (!options.keyEncryptionKeyVaultId && options.keyEncryptionKeyUrl))) {
return _(new Error($("Both --key-encryption-key-vault-id and --key-encryption-key-url have to be specified, or neither of them."))); } ;
if (((options.keyEncryptionKeyVaultId && options.keyEncryptionKeyUrl) && ((!options.diskEncryptionKeyVaultId || !options.diskEncryptionKeyUrl)))) {
return _(new Error($("Options --disk-encryption-key-vault-id and --disk-encryption-key-url must also be specified for key encryption settings."))); } ;
vmClient = new VMClient(cli, options.subscription);
return vmClient.createVM(resourceGroup, name, location, osType, options, __cb(_, __frame, 20, 15, function __$__1() { _(); }, true)); }, true)); }, true)); }, true)); }, true)); }); });
vm.command("quick-create [resource-group] [name] [location] [os-type] [image-urn] [admin-username] [admin-password]").description($("Create a virtual machine with default resources in a resource group")).usage("[options] <resource-group> <name> <location> <os-type> <image-urn> <admin-username> <admin-password>").option("-g, --resource-group <resource-group>", $("the resource group name")).option("-n, --name <name>", $("the virtual machine name")).option("-l, --location <location>", $("the location")).option("-y, --os-type <os-type>", $("the operating system Type, valid values are Windows, Linux")).option("-Q, --image-urn <image-urn>", $((((((("the image URN in the form \"publisherName:offer:skus:version\",\n" + " URN Aliases:\n") + " ") + (utils.getImageAliasList().join("\n "))) + "\n") + " or the VHD link of a user image,\n") + " e.g. https://foo.blob.core.windows.net/bar/vhds/baz.vhd"))).option("-t, --storage-account-name <storage-account-name>", $("Optional -- the storage account name")).option("-z, --vm-size <vm-size>", $("the virtual machine size [Standard_DS1]")).option("-u, --admin-username <admin-username>", $("the user name")).option("-p, --admin-password <admin-password>", $("the password, skipped if SSH public key file is specified for Linux VMs")).option("-M, --ssh-publickey-file <ssh-publickey-file>", $(("the path to public key file for SSH authentication,\n" + " & this parameter is valid only when os-type is Linux."))).option("-w, --public-ip-domain-name <public-ip-domain-name>", $((("Optional -- the public ip domain name\n" + " This sets the DNS to \"<publicip-domain-name>.<location>.cloudapp.azure.com\".\n") + " This parameter will be used only when creating new public IP."))).option("-C, --custom-data <custom-data-file>", $("Optional -- CustomData file")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __2(resourceGroup, name, location, osType, imageUrn, adminUsername, adminPassword, options, _) { var vmClient; var __frame = { name: "__2", line: 168 }; return __func(_, this, arguments, __2, 8, __frame, function __$__2() {
return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1;
return cli.interaction.promptIfNotGiven($("Virtual machine name: "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2;
return cli.interaction.promptIfNotGiven($("Location name: "), location, __cb(_, __frame, 3, 33, function ___(__0, __3) { location = __3;
return cli.interaction.promptIfNotGiven($("Operating system Type [Windows, Linux]: "), osType, __cb(_, __frame, 4, 31, function ___(__0, __4) { osType = __4;
return cli.interaction.promptIfNotGiven($("ImageURN (in the format of \"publisherName:offer:skus:version\") or a VHD link to the user image: "), imageUrn, __cb(_, __frame, 5, 33, function ___(__0, __5) { imageUrn = __5;
return cli.interaction.promptIfNotGiven($("User name: "), adminUsername, __cb(_, __frame, 6, 38, function ___(__0, __6) { adminUsername = __6; return (function __$__2(__then) {
if (!options.sshPublickeyFile) {
return cli.interaction.promptPasswordIfNotGiven($("Password: "), adminPassword, __cb(_, __frame, 9, 40, function ___(__0, __7) { adminPassword = __7; __then(); }, true)); } else { __then(); } ; })(function __$__2() {
location = utils.toLowerCaseAndRemoveSpace(location);
vmClient = new VMClient(cli, options.subscription);
return vmClient.quickCreateVM(resourceGroup, name, location, osType, imageUrn, adminUsername, adminPassword, options, __cb(_, __frame, 13, 15, function __$__2() { _(); }, true)); }); }, true)); }, true)); }, true)); }, true)); }, true)); }, true)); }); });
vm.command("list [resourceGroup]").description($("Get all virtual machines in a resource group")).usage("[options] <resource-group>").option("-g, --resource-group <resource-group>", $("the resource group name")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __3(resourceGroup, options, _) { var vmClient; var __frame = { name: "__3", line: 189 }; return __func(_, this, arguments, __3, 2, __frame, function __$__3() {
vmClient = new VMClient(cli, options.subscription);
return vmClient.listVM(resourceGroup, options, __cb(_, __frame, 2, 15, function __$__3() { _(); }, true)); }); });
vm.command("list-ip-address [resourceGroup]").description($("Get all virtual machines and their corresponding IP addresses in subscription. If a resource group is specified it will list virtual machines and their corresponding IP addresses in specified resource group.")).usage("[options] [resource-group]").option("-g, --resource-group <resource-group>", $("the resource group name")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __4(resourceGroup, options, _) { var vmClient; var __frame = { name: "__4", line: 199 }; return __func(_, this, arguments, __4, 2, __frame, function __$__4() {
vmClient = new VMClient(cli, options.subscription);
return vmClient.listIPAddress(resourceGroup, options, __cb(_, __frame, 2, 15, function __$__4() { _(); }, true)); }); });
vm.command("show [resource-group] [name]").description($("Get a virtual machine in a resource group")).usage("[options] <resource-group> <name>").option("-g, --resource-group <resource-group>", $("the resource group name")).option("-n, --name <name>", $("the virtual machine name")).option("-d, --depth <depth>", $("the number of times to recurse, to recurse indefinitely pass \"full\". (valid only with --json option)")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __5(resourceGroup, name, options, _) { var vmClient; var __frame = { name: "__5", line: 211 }; return __func(_, this, arguments, __5, 3, __frame, function __$__5() {
return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1;
return cli.interaction.promptIfNotGiven($("Virtual machine name: "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2;
vmClient = new VMClient(cli, options.subscription);
return vmClient.showVM(resourceGroup, name, options, __cb(_, __frame, 4, 15, function __$__5() { _(); }, true)); }, true)); }, true)); }); });
vm.command("delete [resource-group] [name]").description($("Delete a virtual machine in a resource group")).usage("[options] <resource-group> <name>").option("-g, --resource-group <resource-group>", $("the resource group name")).option("-n, --name <name>", $("the virtual machine name")).option("-q, --quiet", $("quiet mode, do not ask for delete confirmation")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __6(resourceGroup, name, options, _) { var vmClient; var __frame = { name: "__6", line: 225 }; return __func(_, this, arguments, __6, 3, __frame, function __$__6() {
return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1;
return cli.interaction.promptIfNotGiven($("Virtual machine name: "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2;
vmClient = new VMClient(cli, options.subscription);
return vmClient.deleteVM(resourceGroup, name, options, __cb(_, __frame, 4, 15, function __$__6() { _(); }, true)); }, true)); }, true)); }); });
vm.command("stop [resource-group] [name]").description($("Shutdown a virtual machine in a resource group")).usage("[options] <resource-group> <name>").option("-g, --resource-group <resource-group>", $("the resource group name")).option("-n, --name <name>", $("the virtual machine name")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __7(resourceGroup, name, options, _) { var vmClient; var __frame = { name: "__7", line: 238 }; return __func(_, this, arguments, __7, 3, __frame, function __$__7() {
return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1;
return cli.interaction.promptIfNotGiven($("Virtual machine name: "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2;
vmClient = new VMClient(cli, options.subscription);
return vmClient.stopVM(resourceGroup, name, options, __cb(_, __frame, 4, 15, function __$__7() { _(); }, true)); }, true)); }, true)); }); });
vm.command("restart [resource-group] [name]").description($("Restart a virtual machine in a resource group")).usage("[options] <resource-group> <name>").option("-g, --resource-group <resource-group>", $("the resource group name")).option("-n, --name <name>", $("the virtual machine name")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __8(resourceGroup, name, options, _) { var vmClient; var __frame = { name: "__8", line: 251 }; return __func(_, this, arguments, __8, 3, __frame, function __$__8() {
return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1;
return cli.interaction.promptIfNotGiven($("Virtual machine name: "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2;
vmClient = new VMClient(cli, options.subscription);
return vmClient.restartVM(resourceGroup, name, options, __cb(_, __frame, 4, 15, function __$__8() { _(); }, true)); }, true)); }, true)); }); });
vm.command("start [resource-group] [name]").description($("Start a virtual machine in a resource group")).usage("[options] <resource-group> <name>").option("-g, --resource-group <resource-group>", $("the resource group name")).option("-n, --name <name>", $("the virtual machine name")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __9(resourceGroup, name, options, _) { var vmClient; var __frame = { name: "__9", line: 264 }; return __func(_, this, arguments, __9, 3, __frame, function __$__9() {
return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1;
return cli.interaction.promptIfNotGiven($("Virtual machine name: "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2;
vmClient = new VMClient(cli, options.subscription);
return vmClient.startVM(resourceGroup, name, options, __cb(_, __frame, 4, 15, function __$__9() { _(); }, true)); }, true)); }, true)); }); });
vm.command("deallocate [resource-group] [name]").description($("Shutdown a virtual machine in a resource group and release the compute resources")).usage("[options] <resource-group> <name>").option("-g, --resource-group <resource-group>", $("the resource group name")).option("-n, --name <name>", $("the virtual machine name")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __10(resourceGroup, name, options, _) { var vmClient; var __frame = { name: "__10", line: 277 }; return __func(_, this, arguments, __10, 3, __frame, function __$__10() {
return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1;
return cli.interaction.promptIfNotGiven($("Virtual machine name: "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2;
vmClient = new VMClient(cli, options.subscription);
return vmClient.deallocateVM(resourceGroup, name, options, __cb(_, __frame, 4, 15, function __$__10() { _(); }, true)); }, true)); }, true)); }); });
vm.command("sizes").description($("Get all available virtual machine sizes")).usage("[options]").option("-l, --location <location>", $("the location name, use this to get the list of VM sizes available in a location")).option("-n, --vm-name <vm-name>", $("the virtual machine name, use this to get the list of VM sizes available for a specific VM")).option("-g, --resource-group <resourceGroup>", $("the resource group name, required when --vm-name is specified")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __11(options, _) { var vmClient; var __frame = { name: "__11", line: 291 }; return __func(_, this, arguments, __11, 1, __frame, function __$__11() {
options.location = utils.toLowerCaseAndRemoveSpace(options.location);
vmClient = new VMClient(cli, options.subscription);
return vmClient.listVMSizesOrLocationVMSizes(options, __cb(_, __frame, 3, 15, function __$__11() { _(); }, true)); }); });
vm.command("capture [resource-group] [name] [vhd-name-prefix]").description($("Capture a VM in a resource group as an OS Image or VM Image")).usage("[options] <resource-group> <name> <vhd-name-prefix>").option("-g, --resource-group <resource-group>", $("the resource group name")).option("-n, --name <name>", $("the virtual machine name")).option("-p, --vhd-name-prefix <vhd-name-prefix>", $("Captured virtual hard disk's name prefix")).option("-R, --storage-account-container-name <storage-account-container-name>", $("the storage account container name [vhds]")).option("-o, --overwrite", $("In case of conflict overwrite the target virtual hard disk if set to true.")).option("-t, --template-file-name <template-file-name>", $("Name of the file that will contain a template that can be used to create similar VMs.")).option("-s, --subscription <id>", $("the subscription id")).execute(function __12(resourceGroup, name, vhdNamePrefix, options, _) { var vmClient; var __frame = { name: "__12", line: 307 }; return __func(_, this, arguments, __12, 4, __frame, function __$__12() {
return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1;
return cli.interaction.promptIfNotGiven($("Virtual machine name: "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2;
return cli.interaction.promptIfNotGiven($("Virtual hard disk's name prefix: "), vhdNamePrefix, __cb(_, __frame, 3, 38, function ___(__0, __3) { vhdNamePrefix = __3;
vmClient = new VMClient(cli, options.subscription);
return vmClient.captureVM(resourceGroup, name, vhdNamePrefix, options, __cb(_, __frame, 6, 15, function __$__12() { _(); }, true)); }, true)); }, true)); }, true)); }); });
vm.command("generalize [resource-group] [name]").description($("Set the state of a VM in a resource group to Generalized.")).usage("[options] <resource-group> <name>").option("-g, --resource-group <resource-group>", $("the resource group name")).option("-n, --name <name>", $("the virtual machine name")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __13(resourceGroup, name, options, _) { var vmClient; var __frame = { name: "__13", line: 322 }; return __func(_, this, arguments, __13, 3, __frame, function __$__13() {
return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1;
return cli.interaction.promptIfNotGiven($("Virtual machine name: "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2;
vmClient = new VMClient(cli, options.subscription);
return vmClient.generalizeVM(resourceGroup, name, options, __cb(_, __frame, 5, 15, function __$__13() { _(); }, true)); }, true)); }, true)); }); });
vm.command("get-instance-view [resource-group] [name]").description($("Get instance view of a VM in a resource group.")).usage("[options] <resource-group> <name>").option("-g, --resource-group <resource-group>", $("the resource group name")).option("-n, --name <name>", $("the virtual machine name")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __14(resourceGroup, name, options, _) { var vmClient; var __frame = { name: "__14", line: 336 }; return __func(_, this, arguments, __14, 3, __frame, function __$__14() {
return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1;
return cli.interaction.promptIfNotGiven($("Virtual machine name: "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2;
vmClient = new VMClient(cli, options.subscription);
return vmClient.getInstanceView(resourceGroup, name, options, __cb(_, __frame, 5, 15, function __$__14() { _(); }, true)); }, true)); }, true)); }); });
vm.command("get-serial-output [resource-group] [name]").description($("Get serial output of a VM in a resource group.")).usage("[options] <resource-group> <name>").option("-g, --resource-group <resource-group>", $("the resource group name")).option("-n, --name <name>", $("the virtual machine name")).option("-s, --subscription <subscription>", $("the subscription identifier")).option("--max-length <max-length>", $("the max number of characters shown in one page of log output")).execute(function __15(resourceGroup, name, options, _) { var vmClient; var __frame = { name: "__15", line: 351 }; return __func(_, this, arguments, __15, 3, __frame, function __$__15() {
return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1;
return cli.interaction.promptIfNotGiven($("Virtual machine name: "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2;
vmClient = new VMClient(cli, options.subscription);
return vmClient.getSerialOutput(resourceGroup, name, options, __cb(_, __frame, 5, 15, function __$__15() { _(); }, true)); }, true)); }, true)); }); });
vm.command("reset-access [resource-group] [name]").description($("Enables you to reset Remote Desktop Access or SSH settings on a Virtual Machine and to reset the password for the account that has administrator or sudo authority.")).usage("[options] <resource-group> <name>").option("-g, --resource-group <resource-group>", $("the resource group name")).option("-n, --name <name>", $("the virtual machine name")).option("-u, --user-name <user-name>", $("the user name")).option("-p, --password <password>", $("the password")).option("-M, --ssh-key-file <ssh-key-file>", $("path to public key PEM file or SSH Public key file for SSH authentication (valid only when os-type is \"Linux\")")).option("-r, --reset-ssh", $("Reset the SSH configuration to default")).option("-E, --extension-version <version>", $("Version of VM Access extension [1.4]")).option("-e, --expiration <expiration>", $("password expiration")).option("-R, --remove-user <remove-user-name>", $("Remove a user account with specified name")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __16(resourceGroup, name, options, _) { var vmClient; var __frame = { name: "__16", line: 372 }; return __func(_, this, arguments, __16, 3, __frame, function __$__16() {
return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1;
return cli.interaction.promptIfNotGiven($("Virtual machine name: "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2;
vmClient = new VMClient(cli, options.subscription);
return vmClient.resetVMAccess(resourceGroup, name, options, __cb(_, __frame, 5, 15, function __$__16() { _(); }, true)); }, true)); }, true)); }); });
vm.command("enable-aem [resource-group] [name]").description($("Enable Azure Enhanced Monitoring Extension on a VM in a resource group")).usage("[options] <resource-group> <name>").option("-a, --diagnostic-storage-account-name <name>", $("storage account name")).option("-q, --quiet", $("quite mode(do not ask for confirmation)")).execute(function __17(resourceGroup, name, options, _) { var vmClient; var __frame = { name: "__17", line: 385 }; return __func(_, this, arguments, __17, 3, __frame, function __$__17() {
return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1;
return cli.interaction.promptIfNotGiven($("Virtual machine name: "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2;
vmClient = new VMClient(cli, options.subscription);
return vmClient.enableAemVM(resourceGroup, name, options, __cb(_, __frame, 5, 15, function __$__17() { _(); }, true)); }, true)); }, true)); }); });
vm.command("set [resource-group] [name]").description($("Update a VM in a resource group.")).usage("[options] <resource-group> <name>").option("-g, --resource-group <resource-group>", $("the resource group name")).option("-n, --name <name>", $("the virtual machine name")).option("-I, --nic-ids <nic-ids>", $("the list of NIC identifiers separated by comma. In case of specifying multiple nics first one will be set as primary.")).option("-N, --nic-names <nic-names>", $((("the list of NIC names separated by comma. In case of specifying multiple nics first one will be set as primary." + "These NICs must exists in the same resource group as the VM. Please use nic-ids if that not the case. ") + "This parameter will be ignored if --nic-ids is specified"))).option("-z, --vm-size <vm-size>", $("the virtual machine size")).option("-t, --tags <tags>", $(("Tags to set to the resource group. Can be multiple. " + "In the format of 'name=value'. Name is required and value is optional. For example, -t tag1=value1;tag2"))).option("-T, --no-tags", $("Remove all tags")).option("--new-os-disk-size <new-os-disk-size>", $("new OS disk size in GB")).option("-s, --subscription <subscription>", $("the subscription identifier")).option("--disable-boot-diagnostics", $("The switch parameter to disable the boot diagnostics for VM.")).option("--enable-boot-diagnostics", $("The switch parameter to enable the boot diagnostics for VM.")).option("--boot-diagnostics-storage-uri <boot-diagnostics-storage-uri>", $(("The storage account URL for boot diagnostics. " + "In the format of 'https://your_stoage_account_name.blob.core.windows.net/'."))).execute(function __18(resourceGroup, name, options, _) { var vmClient; var __frame = { name: "__18", line: 412 }; return __func(_, this, arguments, __18, 3, __frame, function __$__18() {
return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1;
return cli.interaction.promptIfNotGiven($("Virtual machine name: "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2;
vmClient = new VMClient(cli, options.subscription);
return vmClient.setVM(resourceGroup, name, options, __cb(_, __frame, 4, 15, function __$__18() { _(); }, true)); }, true)); }, true)); }); });
vm.command("list-usage [location]").description($("Get usage of compute resources.")).usage("[options] <location>").option("-l, --location <location>", $("the location")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __19(location, options, _) { var vmClient; var __frame = { name: "__19", line: 424 }; return __func(_, this, arguments, __19, 2, __frame, function __$__19() {
return cli.interaction.promptIfNotGiven($("Location: "), location, __cb(_, __frame, 1, 35, function ___(__0, __1) { location = __1;
location = utils.toLowerCaseAndRemoveSpace(location);
vmClient = new VMClient(cli, options.subscription);
return vmClient.listComputeUsage(location, options, __cb(_, __frame, 4, 17, function __$__19() { _(); }, true)); }, true)); }); });
vm.command("enable-diag [resource-group] [name]").description($("Enable diagnostics extension on a VM in a resource group.")).usage("[options] <resource-group> <name>").option("-g, --resource-group <resource-group>", $("the resource group name")).option("-n, --name <name>", $("the virtual machine name")).option("-a, --storage-account-name <name>", $("the storage account name")).option("-c, --config-file <path>", $(("path for WadCfg config file" + " (collect basic metrics if not specified)"))).option("-e, --extension-version <version>", util.format($("Version of Diagnostics extension. Default values are [%s] for Windows and [%s] for Linux."), vmConstants.EXTENSIONS.IAAS_DIAG_VERSION, vmConstants.EXTENSIONS.LINUX_DIAG_VERSION)).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __20(resourceGroup, name, options, _) { var vmClient; var __frame = { name: "__20", line: 441 }; return __func(_, this, arguments, __20, 3, __frame, function __$__20() {
return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1;
return cli.interaction.promptIfNotGiven($("Virtual machine name: "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2;
vmClient = new VMClient(cli, options.subscription);
return vmClient.enableDiagVM(resourceGroup, name, options, __cb(_, __frame, 4, 15, function __$__20() { _(); }, true)); }, true)); }, true)); }); });
vm.command("enable-disk-encryption [resource-group] [name]").description($("Enable azure disk encryption on a VM in a resource group.")).usage("[options] <resource-group> <name>").option("-g, --resource-group <resource-group>", $("the resource group name")).option("-n, --name <name>", $("the virtual machine name")).option("-a, --aad-client-id <aad-client-id>", $("Client ID of AAD app with permissions to write secrets to KeyVault")).option("-p, --aad-client-secret <aad-client-secret>", $("Client Secret of AAD app with permissions to write secrets to KeyVault")).option("-c, --aad-client-cert-thumbprint <aad-client-cert-thumbprint>", $("Thumbprint of AAD app certificate with permissions to write secrets to KeyVault")).option("-k, --disk-encryption-key-vault-url <disk-encryption-key-vault-url>", $("URL of the KeyVault where generated encryption key will be placed to")).option("-r, --disk-encryption-key-vault-id <disk-encryption-key-vault-id>", $("ResourceID of the KeyVault where generated encryption key will be placed to")).option("-u, --key-encryption-key-url <key-encryption-key-url>", $("Versioned KeyVault URL of the KeyEncryptionKey used to encrypt the disk encryption key")).option("-i, --key-encryption-key-vault-id <key-encryption-key-vault-id>", $("ResourceID of the KeyVault containing the KeyEncryptionKey used to encrypt the disk encryption key")).option("-l, --key-encryption-algorithm <key-encryption-algorithm>", $("KeyEncryption Algorithm used to encrypt the volume encryption key")).option("-t, --volume-type <volume-type>", $("Type of the volume OS or Data or All to perform encryption operation")).option("-x, --sequence-version <sequence-version>", $("Sequence version of encryption operation. This must be incremented to perform repeated encryption operations on the same VM")).option("-b, --passphrase <passphrase>", $("Passphrase specified in parameter")).option("-q, --quiet", $("quiet mode, do not ask for confirmation")).option("-e, --extension-version <extension-version>", util.format($("Version of AzureDiskEncryption extension. Default values are [%s] for Windows"), vmConstants.EXTENSIONS.AZURE_DISK_ENCRYPTION_WINDOWS_EXTENSION_VERSION)).option("-s, --subscription <subscription>", $("the subscription identifier")).option("-d, --disable-auto-upgrade-minor-version", $("Disable auto-upgrade of minor version")).option("-m, --skip-vm-backup", $("Skip VM backup for Linux")).execute(function __21(resourceGroup, name, options, _) { var vmClient; var __frame = { name: "__21", line: 469 }; return __func(_, this, arguments, __21, 3, __frame, function __$__21() {
return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1;
return cli.interaction.promptIfNotGiven($("Virtual machine name: "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2;
vmClient = new VMClient(cli, options.subscription);
return vmClient.setAzureDiskEncryption(resourceGroup, name, options, __cb(_, __frame, 4, 15, function __$__21() { _(); }, true)); }, true)); }, true)); }); });
vm.command("delete-backup [resource-group] [name]").description($("Deletes the backup for the vm")).usage("[options] <resource-group> <name>").option("-i, --identity <identity>", $("The identity of the backup")).execute(function __22(resourceGroup, name, options, _) { var vmClient; var __frame = { name: "__22", line: 480 }; return __func(_, this, arguments, __22, 3, __frame, function __$__22() {
return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1;
return cli.interaction.promptIfNotGiven($("Virtual machine name: "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2;
vmClient = new VMClient(cli, options.subscription);
return vmClient.removeVMBackup(resourceGroup, name, options, __cb(_, __frame, 4, 15, function __$__22() { _(); }, true)); }, true)); }, true)); }); });
vm.command("show-disk-encryption-status [resource-group] [name]").description($("Show azure disk encryption status of a VM in a resource group.")).usage("[options] <resource-group> <name>").option("-g, --resource-group <resource-group>", $("the resource group name")).option("-n, --name <name>", $("the virtual machine name")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __23(resourceGroup, name, options, _) { var vmClient; var __frame = { name: "__23", line: 493 }; return __func(_, this, arguments, __23, 3, __frame, function __$__23() {
return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1;
return cli.interaction.promptIfNotGiven($("Virtual machine name: "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2;
vmClient = new VMClient(cli, options.subscription);
return vmClient.showAzureDiskEncryptionStatus(resourceGroup, name, options, __cb(_, __frame, 4, 15, function __$__23() { _(); }, true)); }, true)); }, true)); }); });
vm.command("disable-disk-encryption [resource-group] [name]").description($("Disable azure disk encryption on a VM in a resource group.")).usage("[options] <resource-group> <name>").option("-g, --resource-group <resource-group>", $("the resource group name")).option("-n, --name <name>", $("the virtual machine name")).option("-t, --volume-type <volume-type>", $("Type of the volume OS or Data or All to perform encryption operation")).option("-x, --sequence-version <sequence-version>", $("Sequence version of encryption operation. This must be incremented to perform repeated encryption operations on the same VM")).option("-q, --quiet", $("quiet mode, do not ask for confirmation")).option("-e, --extension-version <extension-version>", util.format($("Version of AzureDiskEncryption extension. Default values are [%s] for Windows"), vmConstants.EXTENSIONS.AZURE_DISK_ENCRYPTION_WINDOWS_EXTENSION_VERSION)).option("-s, --subscription <subscription>", $("the subscription identifier")).option("-d, --disable-auto-upgrade-minor-version", $("Disable auto-upgrade of minor version")).execute(function __24(resourceGroup, name, options, _) { var vmClient; var __frame = { name: "__24", line: 511 }; return __func(_, this, arguments, __24, 3, __frame, function __$__24() {
return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1;
return cli.interaction.promptIfNotGiven($("Virtual machine name: "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2;
vmClient = new VMClient(cli, options.subscription);
return vmClient.disableAzureDiskEncryption(resourceGroup, name, options, __cb(_, __frame, 4, 15, function __$__24() { _(); }, true)); }, true)); }, true)); }); });
var disk = vm.category("disk").description($("Commands to manage your Virtual Machine data disks"));
disk.command("attach-new [resource-group] [vm-name] [size-in-gb] [vhd-name]").description($("Attach a new data-disk to a VM in a resource group")).usage("[options] <resource-group> <vm-name> <size-in-gb> [vhd-name]").option("-g, --resource-group <resource-group>", $("the resource group name")).option("-n, --vm-name <vm-name>", $("the virtual machine name")).option("-z, --size-in-gb <size-in-gb>", $("the disk size in GB")).option("-d, --vhd-name <vhd-name>", $("the name for the new VHD")).option("-c, --host-caching <name>", $("the caching behaviour of disk [None, ReadOnly, ReadWrite]")).option("-o, --storage-account-name <storageAccountName>", $("the storage account name")).option("-r, --storage-account-container-name <storageAccountContainerName>", $("the storage account container name [vhds]")).option("-l, --lun <lun>", $("zero based logical unit number of the data disk")).option("-s, --subscription <id>", $("the subscription id")).execute(function __25(resourceGroup, vmName, size, vhdName, options, _) { var vmClient; var __frame = { name: "__25", line: 533 }; return __func(_, this, arguments, __25, 5, __frame, function __$__25() {
return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 1, 40, function ___(__0, __1) { resourceGroup = __1;
return cli.interaction.promptIfNotGiven($("Virtual machine name: "), vmName, __cb(_, __frame, 2, 33, function ___(__0, __2) { vmName = __2;
return cli.interaction.promptIfNotGiven($("Disk size in gb: "), size, __cb(_, __frame, 3, 31, function ___(__0, __3) { size = __3;
vmClient = new VMClient(cli, options.subscription);
return vmClient.attachNewDataDisk(resourceGroup, vmName, size, vhdName, options, __cb(_, __frame, 5, 17, function __$__25() { _(); }, true)); }, true)); }, true)); }, true)); }); });
disk.command("detach [resource-group] [vm-name] [lun]").description($("Detach a data-disk attached to a VM in a resource group")).usage("[options] <resource-group> <vm-name> <lun>").option("-g, --resource-group <resource-group>", $("the resource group name")).option("-n, --vm-name <vm-name>", $("the virtual machine name")).option("-l, --lun <lun>", $("the data disk lun")).option("-s, --subscription <id>", $("the subscription id")).execute(function __26(resourceGroup, vmName, lun, options, _) { var vmClient; var __frame = { name: "__26", line: 548 }; return __func(_, this, arguments, __26, 4, __frame, function __$__26() {
return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 1, 40, function ___(__0, __1) { resourceGroup = __1;
return cli.interaction.promptIfNotGiven($("Virtual machine name: "), vmName, __cb(_, __frame, 2, 33, function ___(__0, __2) { vmName = __2;
return cli.interaction.promptIfNotGiven($("Data disk lun: "), lun, __cb(_, __frame, 3, 30, function ___(__0, __3) { lun = __3;
vmClient = new VMClient(cli, options.subscription);
return vmClient.detachDataDisk(resourceGroup, vmName, lun, options, __cb(_, __frame, 6, 17, function __$__26() { _(); }, true)); }, true)); }, true)); }, true)); }); });
disk.command("attach [resource-group] [vm-name] [vhd-url]").description($("Attach a new data-disk to a VM in a resource group")).usage("[options] <resource-group> <vm-name> [vhd-url]").option("-g, --resource-group <resource-group>", $("the resource group name")).option("-n, --vm-name <vm-name>", $("the virtual machine name")).option("-d, --vhd-url <vhd-url>", $("the URL of existing VHD")).option("-c, --host-caching <name>", $("the caching behaviour of disk [None, ReadOnly, ReadWrite]")).option("-l, --lun <lun>", $("zero based logical unit number of the data disk")).option("-s, --subscription <id>", $("the subscription id")).execute(function __27(resourceGroup, vmName, vhdUrl, options, _) { var vmClient; var __frame = { name: "__27", line: 566 }; return __func(_, this, arguments, __27, 4, __frame, function __$__27() {
return cli.interaction.promptIfNotGiven(