Azure 经典 CLI 命令Azure classic CLI commands

重要

经典 VM 将于 2023 年 3 月 1 日停用。Classic VMs will be retired on March 1, 2023.

如果从 ASM 使用 IaaS 资源,请在 2023 年 3 月 1 日之前完成迁移。If you use IaaS resources from ASM, please complete your migration by March 1, 2023. 我们建议你尽快进行切换,以利用 Azure 资源管理器中的许多增强功能。We encourage you to make the switch sooner to take advantage of the many feature enhancements in Azure Resource Manager.

有关详细信息,请参阅在 2023 年 3 月 1 日之前将 IaaS 资源迁移到 Azure 资源管理器For more information, see Migrate your IaaS resources to Azure Resource Manager by March 1, 2023.

本主题介绍如何安装 Azure 经典 CLI。This topic describes how to install the Azure classic CLI. 此经典 CLI 已弃用,只能与经典部署模型配合使用。The classic CLI is deprecated and should only be used with the classic deployment model. 进行所有其他的部署时,请使用 Azure CLIFor all other deployments, use the Azure CLI.

本文提供经常用于创建和管理 Azure 资源的 Azure 经典命令行接口 (CLI) 命令的语法和选项。This article provides syntax and options for Azure classic command-line interface (CLI) commands you'd commonly use to create and manage Azure resources. 本参考内容并不完整,CLI 版本可能会显示稍微不同的命令或参数。This is not a complete reference, and your CLI version may show slightly different commands or parameters.

若要开始,请先安装 Azure 经典 CLI连接到 Azure 订阅To get started, first install the Azure classic CLI and connect to your Azure subscription.

要在 Resource Manager 模式下在命令行中查看当前的命令语法和选项,请键入 azure help;要显示某个命令的帮助,请键入 azure help [command]For current command syntax and options at the command line in Resource Manager mode, type azure help or, to display help for a specific command, azure help [command]. 还可以在创建和管理特定 Azure 服务的说明文档中找到 CLI 示例。Also find CLI examples in the documentation for creating and managing specific Azure services.

可选参数显示在方括号中(例如,[parameter])。Optional parameters are shown in square brackets (for example, [parameter]). 其他所有参数都是必需的。All other parameters are required.

除了此处记录的特定于命令的可选参数外,还有三个可用于显示详细输出(例如请求选项和状态代码)的可选参数。In addition to command-specific optional parameters documented here, there are three optional parameters that can be used to display detailed output such as request options and status codes. -v 参数提供详细输出,-vv 参数提供更详细的输出。The -v parameter provides verbose output, and the -vv parameter provides even more detailed verbose output. --json 选项以原始的 json 格式输出结果。The --json option outputs the result in raw json format.

设置 Resource Manager 模式Setting the Resource Manager mode

使用以下命令启用 Azure CLI Resource Manager 模式命令。Use the following command to enable Azure CLI Resource Manager mode commands.

    azure config mode arm

备注

CLI 的 Azure Resource Manager 模式与 Azure 服务管理模式互斥。The CLI's Azure Resource Manager mode and Azure Service Management mode are mutually exclusive. 即,在一种模式下创建的资源不能通过另一种模式进行管理。That is, resources created in one mode cannot be managed from the other mode.

帐户信息Account information

该工具使用 Azure 订阅信息连接到帐户。Your Azure subscription information is used by the tool to connect to your account.

列出导入的订阅List the imported subscriptions

    account list [options]

显示有关订阅的详细信息Show details about a subscription

    account show [options] [subscriptionNameOrId]

设置当前订阅Set the current subscription

    account set [options] <subscriptionNameOrId>

删除订阅或环境,或清除所有存储的帐户和环境信息Remove a subscription or environment, or clear all of the stored account and environment info

    account clear [options]

用于管理帐户环境的命令Commands to manage your account environment

    account env list [options]
    account env show [options] [environment]
    account env add [options] [environment]
    account env set [options] [environment]
    account env delete [options] [environment]

Active Directory 对象Active Directory objects

用于显示 Active Directory 应用程序的命令Commands to display active directory applications

    ad app create [options]
    ad app delete [options] <object-id>

用于显示 Active Directory 组的命令Commands to display active directory groups

    ad group list [options]
    ad group show [options]

用于提供 Active Directory 子组或成员信息的命令Commands to provide an active directory sub group or member info

    ad group member list [options] [objectId]

用于显示 Active Directory 服务主体的命令Commands to display active directory service principals

    ad sp list [options]
    ad sp show [options]
    ad sp create [options] <application-id>
    ad sp delete [options] <object-id>

用于显示 Active Directory 用户的命令Commands to display active directory users

    ad user list [options]
    ad user show [options]

可用性集Availability sets

在资源组中创建可用性集Creates an availability set within a resource group

    availset create [options] <resource-group> <name> <location> [tags]

列出资源组中的可用性集Lists the availability sets within a resource group

    availset list [options] <resource-group>

获取资源组中的一个可用性集Gets one availability set within a resource group

    availset show [options] <resource-group> <name>

删除资源组中的一个可用性集Deletes one availability set within a resource group

    availset delete [options] <resource-group> <name>

本地设置Local settings

列出 Azure CLI 配置设置List Azure CLI configuration settings

    config list [options]

删除配置设置Delete a config setting

    config delete [options] <name>

更新配置设置Update a config setting

    config set <name> <value>

将 Azure CLI 工作模式设置为 armasmSets the Azure CLI working mode to either arm or asm

    config mode [options] <modename>

帐户功能Account features

列出订阅可用的所有功能List all features available for your subscription

    feature list [options]

显示一项功能Shows a feature

    feature show [options] <providerName> <featureName>

注册资源提供程序的预览功能Registers a previewed feature of a resource provider

    feature register [options] <providerName> <featureName>

资源组Resource groups

创建资源组Creates a resource group

    group create [options] <name> <location>

向资源组设置标记Set tags to a resource group

    group set [options] <name> <tags>

删除资源组Deletes a resource group

    group delete [options] <name>

列出订阅的资源组Lists the resource groups for your subscription

    group list [options]

显示订阅的资源组Shows a resource group for your subscription

    group show [options] <name>

用于管理资源组日志的命令Commands to manage resource group logs

    group log show [options] [name]

用于管理资源组中的部署的命令Commands to manage your deployment in a resource group

    group deployment create [options] [resource-group] [name]
    group deployment list [options] <resource-group> [state]
    group deployment show [options] <resource-group> [deployment-name]
    group deployment stop [options] <resource-group> [deployment-name]

用于管理本地或库资源组模板的命令Commands to manage your local or gallery resource group template

    group template list [options]
    group template show [options] <name>
    group template download [options] [name] [file]
    group template validate [options] <resource-group>

HDInsight 群集HDInsight clusters

用于创建群集配置文件或在其中添加信息的命令Commands to create or add to a cluster configuration file

    hdinsight config create [options] <configFilePath> <overwrite>
    hdinsight config add-config-values [options] <configFilePath>
    hdinsight config add-script-action [options] <configFilePath>

示例:创建一个配置文件,其中包含创建群集时要运行的脚本操作。Example: Create a configuration file that contains a script action to run when creating a cluster.

    hdinsight config create "C:\myFiles\configFile.config"
    hdinsight config add-script-action --configFilePath "C:\myFiles\configFile.config" --nodeType HeadNode --uri <scriptActionURI> --name myScriptAction --parameters "-param value"

用于在资源组中创建群集的命令Command to create a cluster in a resource group

    hdinsight cluster create [options] <clusterName>

示例:在 Linux 群集上创建 StormExample: Create a Storm on Linux cluster

    azure hdinsight cluster create -g myarmgroup -l chinanorth -y Linux --clusterType Storm --version 3.2 --defaultStorageAccountName mystorageaccount --defaultStorageAccountKey <defaultStorageAccountKey> --defaultStorageContainer mycontainer --userName admin --password <clusterPassword> --sshUserName sshuser --sshPassword <sshPassword> --workerNodeCount 1 myNewCluster01

    info:    Executing command hdinsight cluster create
    + Submitting the request to create cluster...
    info:    hdinsight cluster create command OK

示例:使用脚本操作创建群集Example: Create a cluster with a script action

    azure hdinsight cluster create -g myarmgroup -l chinanorth -y Linux --clusterType Hadoop --version 3.2 --defaultStorageAccountName mystorageaccount --defaultStorageAccountKey <defaultStorageAccountKey> --defaultStorageContainer mycontainer --userName admin --password <clusterPassword> --sshUserName sshuser --sshPassword <sshPassword> --workerNodeCount 1 -configurationPath "C:\myFiles\configFile.config" myNewCluster01

    info:    Executing command hdinsight cluster create
    + Submitting the request to create cluster...
    info:    hdinsight cluster create command OK

参数选项:Parameter options:

    -h, --help                                                 output usage information
    -v, --verbose                                              use verbose output
    -vv                                                        more verbose with debug output
    --json                                                     use json output
    -g --resource-group <resource-group>                       The name of the resource group
    -c, --clusterName <clusterName>                            HDInsight cluster name
    -l, --location <location>                                  Data center location for the cluster
    -y, --osType <osType>                                      HDInsight cluster operating system
    'Windows' or 'Linux'
    --version <version>                                        HDInsight cluster version
    --clusterType <clusterType>                                HDInsight cluster type.
    Hadoop | HBase | Spark | Storm
    --defaultStorageAccountName <storageAccountName>           Storage account url to use for default HDInsight storage
    --defaultStorageAccountKey <storageAccountKey>             Key to the storage account to use for default HDInsight storage
    --defaultStorageContainer <storageContainer>               Container in the storage account to use for HDInsight default storage
    --headNodeSize <headNodeSize>                              (Optional) Head node size for the cluster
    --workerNodeCount <workerNodeCount>                        Number of worker nodes to use for the cluster
    --workerNodeSize <workerNodeSize>                          (Optional) Worker node size for the cluster)
    --zookeeperNodeSize <zookeeperNodeSize>                    (Optional) Zookeeper node size for the cluster
    --userName <userName>                                      Cluster username
    --password <password>                                      Cluster password
    --sshUserName <sshUserName>                                SSH username (only for Linux clusters)
    --sshPassword <sshPassword>                                SSH password (only for Linux clusters)
    --sshPublicKey <sshPublicKey>                              SSH public key (only for Linux clusters)
    --rdpUserName <rdpUserName>                                RDP username (only for Windows clusters)
    --rdpPassword <rdpPassword>                                RDP password (only for Windows clusters)
    --rdpAccessExpiry <rdpAccessExpiry>                        RDP access expiry.
    For example 12/12/2015 (only for Windows clusters)
    --virtualNetworkId <virtualNetworkId>                      (Optional) Virtual network ID for the cluster.
    Value is a GUID for Windows cluster and ARM resource ID for Linux cluster)
    --subnetName <subnetName>                                  (Optional) Subnet for the cluster
    --additionalStorageAccounts <additionalStorageAccounts>    (Optional) Additional storage accounts.
    Can be multiple.
    In the format of 'accountName#accountKey'.
    For example, --additionalStorageAccounts "acc1#key1;acc2#key2"
    --hiveMetastoreServerName <hiveMetastoreServerName>        (Optional) SQL Server name for the external metastore for Hive
    --hiveMetastoreDatabaseName <hiveMetastoreDatabaseName>    (Optional) Database name for the external metastore for Hive
    --hiveMetastoreUserName <hiveMetastoreUserName>            (Optional) Database username for the external metastore for Hive
    --hiveMetastorePassword <hiveMetastorePassword>            (Optional) Database password for the external metastore for Hive
    --oozieMetastoreServerName <oozieMetastoreServerName>      (Optional) SQL Server name for the external metastore for Oozie
    --oozieMetastoreDatabaseName <oozieMetastoreDatabaseName>  (Optional) Database name for the external metastore for Oozie
    --oozieMetastoreUserName <oozieMetastoreUserName>          (Optional) Database username for the external metastore for Oozie
    --oozieMetastorePassword <oozieMetastorePassword>          (Optional) Database password for the external metastore for Oozie
    --configurationPath <configurationPath>                    (Optional) HDInsight cluster configuration file path
    -s, --subscription <id>                                    The subscription id
    --tags <tags>                                              Tags to set to the cluster.
    Can be multiple.
    In the format of 'name=value'.
    Name is required and value is optional.
    For example, --tags tag1=value1;tag2

用于删除群集的命令Command to delete a cluster

    hdinsight cluster delete [options] <clusterName>

用于显示群集详细信息的命令Command to show cluster details

    hdinsight cluster show [options] <clusterName>

用于(在特定资源组中,如已提供)列出所有群集的命令Command to list all clusters (in a specific resource group, if provided)

    hdinsight cluster list [options]

用于调整群集大小的命令Command to resize a cluster

    hdinsight cluster resize [options] <clusterName> <targetInstanceCount>

用于对群集启用 HTTP 访问的命令Command to enable HTTP access for a cluster

    hdinsight cluster enable-http-access [options] <clusterName> <userName> <password>

用于对群集禁用 HTTP 访问的命令Command to disable HTTP access for a cluster

    hdinsight cluster disable-http-access [options] <clusterName>

用于对群集启用 RDP 访问的命令Command to enable RDP access for a cluster

    hdinsight cluster enable-rdp-access [options] <clusterName> <rdpUserName> <rdpPassword> <rdpExpiryDate>

用于对群集禁用 HTTP 访问的命令Command to disable HTTP access for a cluster

    hdinsight cluster disable-rdp-access [options] <clusterName>

见解(事件、警报规则、自动缩放设置、指标)Insights (events, alert rules, autoscale settings, metrics)

检索订阅、correlationId、资源组、资源或资源提供程序的操作日志Retrieve operation logs for a subscription, a correlationId, a resource group, resource, or resource provider

    insights logs list [options]

位置Locations

列出可用位置List the available locations

    location list [options]

网络资源Network resources

用于管理虚拟网络的命令Commands to manage virtual networks

    network vnet create [options] <resource-group> <name> <location>

创建虚拟网络。Creates a virtual network. 在以下示例中,我们将为中国北部区域的资源组 myresourcegroup 创建名为 newvnet 的虚拟网络。In the following example we create a virtual network named newvnet for resource group myresourcegroup in the China North region.

    azure network vnet create myresourcegroup newvnet "China North"
    info:    Executing command network vnet create
    + Looking up virtual network "newvnet"
    + Creating virtual network "newvnet"
     Loading virtual network state
    data:    Id:                   /subscriptions/###############################/resourceGroups/myresourcegroup/providers/Microsoft.Network/virtualNetworks/newvnet
    data:    Name:                 newvnet
    data:    Type:                 Microsoft.Network/virtualNetworks
    data:    Location:             chinanorth
    data:    Tags:
    data:    Provisioning state:   Succeeded
    data:    Address prefixes:
    data:     10.0.0.0/8
    data:    DNS servers:
    data:    Subnets:
    data:
    info:    network vnet create command OK

参数选项:Parameter options:

     -h, --help                                 output usage information
     -v, --verbose                              use verbose output
    --json                                     use json output
     -g, --resource-group <resource-group>      the name of the resource group
     -n, --name <name>                          the name of the virtual network
     -l, --location <location>                  the location
     -a, --address-prefixes <address-prefixes>  the comma separated list of address prefixes for this virtual network
      For example -a 10.0.0.0/24,10.0.1.0/24.
      Default value is 10.0.0.0/8

    -d, --dns-servers <dns-servers>            the comma separated list of DNS servers IP addresses
     -t, --tags <tags>                          the tags set on this virtual network.
      Can be multiple. In the format of "name=value".
      Name is required and value is optional.
      For example, -t tag1=value1;tag2
     -s, --subscription <subscription>          the subscription identifier

    network vnet set [options] <resource-group> <name>

更新资源组中的虚拟网络配置。Updates a virtual network configuration within a resource group.

    azure network vnet set myresourcegroup newvnet

    info:    Executing command network vnet set
    + Looking up virtual network "newvnet"
    + Updating virtual network "newvnet"
    + Loading virtual network state
    data:    Id:                   /subscriptions/###############################/resourceGroups/myresourcegroup/providers/Microsoft.Network/virtualNetworks/newvnet
    data:    Name:                 newvnet
    data:    Type:                 Microsoft.Network/virtualNetworks
    data:    Location:             chinanorth
    data:    Tags:
    data:    Provisioning state:   Succeeded
    data:    Address prefixes:
    data:     10.0.0.0/8
    data:    DNS servers:
    data:    Subnets:
    data:
    info:    network vnet set command OK

参数选项:Parameter options:

    -h, --help                                 output usage information
    -v, --verbose                              use verbose output
    --json                                     use json output
    -g, --resource-group <resource-group>      the name of the resource group
    -n, --name <name>                          the name of the virtual network
    -a, --address-prefixes <address-prefixes>  the comma separated list of address prefixes for this virtual network.
        For example -a 10.0.0.0/24,10.0.1.0/24.
        This list will be appended to the current list of address prefixes.
        The address prefixes in this list should not overlap between them.
        The address prefixes in this list should not overlap with existing address prefixes in the vnet.
    -d, --dns-servers [dns-servers]            the comma separated list of DNS servers IP addresses.
        This list will be appended to the current list of DNS server IP addresses.

    -t, --tags <tags>                          the tags set on this virtual network.
        Can be multiple. In the format of "name=value".
        Name is required and value is optional. For example, -t tag1=value1;tag2.
        This list will be appended to the current list of tags

    --no-tags                                  remove all existing tags
    -s, --subscription <subscription>          the subscription identifier

    network vnet list [options] <resource-group>

该命令列出资源组中的所有虚拟网络。The command lists all virtual networks in a resource group.

    C:\>azure network vnet list myresourcegroup

    info:    Executing command network vnet list
    + Listing virtual networks
        data:    ID
       Name      Location  Address prefixes  DNS servers
    data:    -------------------------------------------------------------------
    ------  --------  --------  ----------------  -----------
    data:    /subscriptions/###############################/resourceGroups/
    wvnet   newvnet   chinanorth    10.0.0.0/8
    info:    network vnet list command OK

参数选项:Parameter options:

      -h, --help                             output usage information
      -v, --verbose                          use verbose output
      --json                                 use json output
      -g, --resource-group <resource-group>  the name of the resource group
      -s, --subscription <subscription>      the subscription identifier

    network vnet show [options] <resource-group> <name>

该命令显示资源组中的虚拟网络属性。The command shows the virtual network properties in a resource group.

    azure network vnet show -g myresourcegroup -n newvnet

    info:    Executing command network vnet show
    + Looking up virtual network "newvnet"
    data:    Id:                   /subscriptions/###############################/resourceGroups/myresourcegroup/providers/Microsoft.Network/virtualNetworks/newvnet
    data:    Name:                 newvnet
    data:    Type:                 Microsoft.Network/virtualNetworks
    data:    Location:             chinanorth
    data:    Tags:
    data:    Provisioning state:   Succeeded
    data:    Address prefixes:
    data:     10.0.0.0/8
    data:    DNS servers:
    data:    Subnets:
    data:
    info:    network vnet show command OK

    network vnet delete [options] <resource-group> <name>

该命令删除虚拟网络。The command removes a virtual network.

    azure network vnet delete myresourcegroup newvnetX

    info:    Executing command network vnet delete
    + Looking up virtual network "newvnetX"
    Delete virtual network newvnetX? [y/n] y
    + Deleting virtual network "newvnetX"
    info:    network vnet delete command OK

参数选项:Parameter options:

     -h, --help                             output usage information
     -v, --verbose                          use verbose output
     --json                                 use json output
     -g, --resource-group <resource-group>  the name of the resource group
     -n, --name <name>                      the name of the virtual network
     -q, --quiet                            quiet mode, do not ask for delete confirmation
     -s, --subscription <subscription>      the subscription identifier

用于管理虚拟网络子网的命令Commands to manage virtual network subnets

    network vnet subnet create [options] <resource-group> <vnet-name> <name>

将另一个子网添加到现有的虚拟网络。Adds another subnet to an existing virtual network.

    azure network vnet subnet create -g myresourcegroup --vnet-name newvnet -n subnet --address-prefix 10.0.1.0/24

    info:    Executing command network vnet subnet create
    + Looking up the subnet "subnet"
    + Creating subnet "subnet"
    + Looking up the subnet "subnet"
    data:    Id:                        /subscriptions/###############################/resourceGroups/myresourcegroup/providers/Microsoft.Network/virtualNetworks/newvnet/subnets/subnet
    data:    Name:                      subnet
    data:    Type:                      Microsoft.Network/virtualNetworks/subnets
    data:    Provisioning state:        Succeeded
    data:    Address prefix:            10.0.1.0/24
    info:    network vnet subnet create command OK

参数选项:Parameter options:

     -h, --help                                                       output usage information
     -v, --verbose                                                    use verbose output
         --json                                                           use json output
     -g, --resource-group <resource-group>                            the name of the resource group
     -e, --vnet-name <vnet-name>                                      the name of the virtual network
     -n, --name <name>                                                the name of the subnet
     -a, --address-prefix <address-prefix>                            the address prefix
     -w, --network-security-group-id <network-security-group-id>      the network security group identifier.
           e.g. /subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Network/networkSecurityGroups/<nsg-name>
     -o, --network-security-group-name <network-security-group-name>  the network security group name
     -s, --subscription <subscription>                                the subscription identifier

    network vnet subnet set [options] <resource-group> <vnet-name> <name>

在资源组中设置特定的虚拟网络子网。Sets a specific virtual network subnet within a resource group.

    C:\>azure network vnet subnet set -g myresourcegroup --vnet-name newvnet -n subnet1

    info:    Executing command network vnet subnet set
    + Looking up the subnet "subnet1"
    + Setting subnet "subnet1"
    + Looking up the subnet "subnet1"
    data:    Id:                        /subscriptions/###############################/resourceGroups/myresourcegroup/providers/Microsoft.Network/virtualNetworks/newvnet/subnets/subnet1
    data:    Name:                      subnet1
    data:    Type:                      Microsoft.Network/virtualNetworks/subnets
    data:    Provisioning state:        Succeeded
    data:    Address prefix:            10.0.1.0/24
    info:    network vnet subnet set command OK

    network vnet subnet list [options] <resource-group> <vnet-name>

列出资源组中特定虚拟网络的所有虚拟网络子网。Lists all the virtual network subnets for a specific virtual network within a resource group.

    azure network vnet subnet set -g myresourcegroup --vnet-name newvnet -n subnet1

    info:    Executing command network vnet subnet set
    + Looking up the subnet "subnet1"
    + Setting subnet "subnet1"
    + Looking up the subnet "subnet1"
    data:    Id:                        /subscriptions/###############################/resourceGroups/myresourcegroup/providers/Microsoft.Network/virtualNetworks/newvnet/subnets/subnet1
    data:    Name:                      subnet1
    data:    Type:                      Microsoft.Network/virtualNetworks/subnets
    data:    Provisioning state:        Succeeded
    data:    Address prefix:            10.0.1.0/24
    info:    network vnet subnet set command OK

    network vnet subnet show [options] <resource-group> <vnet-name> <name>

显示虚拟网络子网属性Displays virtual network subnet properties

    azure network vnet subnet show -g myresourcegroup --vnet-name newvnet -n subnet1

    info:    Executing command network vnet subnet show
    + Looking up the subnet "subnet1"
    data:    Id:                        /subscriptions/###############################/resourceGroups/myresourcegroup/providers/Microsoft
    .Network/virtualNetworks/newvnet/subnets/subnet1
    data:    Name:                      subnet1
    data:    Type:                      Microsoft.Network/virtualNetworks/subnets
    data:    Provisioning state:        Succeeded
    data:    Address prefix:            10.0.1.0/24
    info:    network vnet subnet show command OK

参数选项:Parameter options:

    -h, --help                             output usage information
    -v, --verbose                          use verbose output
    --json                                 use json output
    -g, --resource-group <resource-group>  the name of the resource group
    -e, --vnet-name <vnet-name>            the name of the virtual network
    -n, --name <name>                      the name of the subnet
    -s, --subscription <subscription>      the subscription identifier

    network vnet subnet delete [options] <resource-group> <vnet-name> <subnet-name>

从现有虚拟网络中删除子网。Removes a subnet from an existing virtual network.

    azure network vnet subnet delete -g myresourcegroup --vnet-name newvnet -n subnet1

    info:    Executing command network vnet subnet delete
    + Looking up the subnet "subnet1"
    Delete subnet "subnet1"? [y/n] y
    + Deleting subnet "subnet1"
    info:    network vnet subnet delete command OK

参数选项:Parameter options:

     -h, --help                             output usage information
     -v, --verbose                          use verbose output
     --json                                 use json output
     -g, --resource-group <resource-group>  the name of the resource group
     -e, --vnet-name <vnet-name>            the name of the virtual network
     -n, --name <name>                      the subnet name
     -s, --subscription <subscription>      the subscription identifier
     -q, --quiet                            quiet mode, do not ask for delete confirmation

用于管理负载均衡器的命令Commands to manage load balancers

    network lb create [options] <resource-group> <name> <location>

创建负载均衡器集。Creates a load balancer set.

    azure network lb create -g myresourcegroup -n mylb -l chinanorth

    info:    Executing command network lb create
    + Looking up the load balancer "mylb"
    + Creating load balancer "mylb"
    + Looking up the load balancer "mylb"
    data:    Id:                           /subscriptions/###############################/resourceGroups/myresourcegroup/providers/Microsoft.Network/loadBalancers/mylb
    data:    Name:                         mylb
    data:    Type:                         Microsoft.Network/loadBalancers
    data:    Location:                     chinanorth
    data:    Provisioning state:           Succeeded
    info:    network lb create command OK

参数选项:Parameter options:

    -h, --help                             output usage information
    -v, --verbose                          use verbose output
    --json                                 use json output
    -g, --resource-group <resource-group>  the name of the resource group
    -n, --name <name>                      the name of the load balancer
    -l, --location <location>              the location
    -t, --tags <tags>                      the list of tags.
     Can be multiple. In the format of "name=value".
     Name is required and value is optional. For example, -t tag1=value1;tag2
    -s, --subscription <subscription>      the subscription identifier

    network lb list [options] <resource-group>

列出资源组中的负载均衡器资源。Lists Load balancer resources within a resource group.

    azure network lb list myresourcegroup

    info:    Executing command network lb list
    + Getting the load balancers
    data:    Name  Location
    data:    ---- --------
    data:    mylb  chinanorth
    info:    network lb list command OK

参数选项:Parameter options:

    -h, --help                             output usage information
    -v, --verbose                          use verbose output
    --json                                 use json output
    -g, --resource-group <resource-group>  the name of the resource group
    -s, --subscription <subscription>      the subscription identifier

    network lb show [options] <resource-group> <name>

显示资源组中特定负载均衡器的负载均衡器信息Displays load balancer information of a specific load balancer within a resource group

    azure network lb show myresourcegroup mylb -v

    info:    Executing command network lb show
    verbose: Looking up the load balancer "mylb"
    data:    Id:                           /subscriptions/###############################/resourceGroups/myresourcegroup/providers/Microsoft.Network/loadBalancers/mylb
    data:    Name:                         mylb
    data:    Type:                         Microsoft.Network/loadBalancers
    data:    Location:                     chinanorth
    data:    Provisioning state:           Succeeded
    info:    network lb show command OK

参数选项:Parameter options:

    -h, --help                             output usage information
    -v, --verbose                          use verbose output
    --json                                 use json output
    -g, --resource-group <resource-group>  the name of the resource group
    -n, --name <name>                      the name of the load balancer
    -s, --subscription <subscription>      the subscription identifier

    network lb delete [options] <resource-group> <name>

删除负载均衡器资源。Delete load balancer resources.

    azure network lb delete  myresourcegroup mylb

    info:    Executing command network lb delete
    + Looking up the load balancer "mylb"
    Delete load balancer "mylb"? [y/n] y
    + Deleting load balancer "mylb"
    info:    network lb delete command OK

参数选项:Parameter options:

     -h, --help                             output usage information
     -v, --verbose                          use verbose output
     --json                                 use json output
     -g, --resource-group <resource-group>  the name of the resource group
     -n, --name <name>                      the name of the load balancer
     -q, --quiet                            quiet mode, do not ask for delete confirmation
     -s, --subscription <subscription>      the subscription identifier

用于管理负载均衡器探测的命令Commands to manage probes of a load balancer

    network lb probe create [options] <resource-group> <lb-name> <name>

在负载均衡器中创建运行状况状态探测配置。Create the probe configuration for health status in the load balancer. 请记住,若要运行此命令,负载均衡器需要一个前端 IP 资源(发出命令“azure network frontend-ip”可向负载均衡器分配 IP 地址)。Keep in mind to run this command, your load balancer requires a frontend-ip resource (Check out command "azure network frontend-ip" to assign an ip address to load balancer).

    azure network lb probe create -g myresourcegroup --lb-name mylb -n mylbprobe --protocol tcp --port 80 -i 300

    info:    Executing command network lb probe create
    + Looking up the load balancer "mylb"
    + Updating load balancer "mylb"
    info:    network lb probe create command OK

参数选项:Parameter options:

     -h, --help                             output usage information
     -v, --verbose                          use verbose output
     --json                                 use json output
    -g, --resource-group <resource-group>  the name of the resource group
    -l, --lb-name <lb-name>                the name of the load balancer
    -n, --name <name>                      the name of the probe
    -p, --protocol <protocol>              the probe protocol
    -o, --port <port>                      the probe port
    -f, --path <path>                      the probe path
    -i, --interval <interval>              the probe interval in seconds
    -c, --count <count>                    the number of probes
    -s, --subscription <subscription>      the subscription identifier

    network lb probe set [options] <resource-group> <lb-name> <name>

使用新值更新现有的负载均衡器探测。Updates an existing load balancer probe with new values for it.

    azure network lb probe set -g myresourcegroup -l mylb -n mylbprobe -p mylbprobe1 -p TCP -o 443 -i 300

    info:    Executing command network lb probe set
        + Looking up the load balancer "mylb"
    + Updating load balancer "mylb"
    info:    network lb probe set command OK

参数选项Parameter options

    -h, --help                             output usage information
    -v, --verbose                          use verbose output
    --json                                 use json output
    -g, --resource-group <resource-group>  the name of the resource group
    -l, --lb-name <lb-name>                the name of the load balancer
    -n, --name <name>                      the name of the probe
    -e, --new-probe-name <new-probe-name>  the new name of the probe
    -p, --protocol <protocol>              the new value for probe protocol
    -o, --port <port>                      the new value for probe port
    -f, --path <path>                      the new value for probe path
    -i, --interval <interval>              the new value for probe interval in seconds
    -c, --count <count>                    the new value for number of probes
    -s, --subscription <subscription>      the subscription identifier

    network lb probe list [options] <resource-group> <lb-name>

列出负载均衡器集的探测属性。List the probe properties for a load balancer set.

    C:\>azure network lb probe list -g myresourcegroup -l mylb

    info:    Executing command network lb probe list
    + Looking up the load balancer "mylb"
    data:    Name       Protocol  Port  Path  Interval  Count
    data:    ---------  --------  ----  ----  --------  -----
    data:    mylbprobe  Tcp       443         300       2
    info:    network lb probe list command OK

参数选项:Parameter options:

    -h, --help                             output usage information
    -v, --verbose                          use verbose output
    --json                                 use json output
    -g, --resource-group <resource-group>  the name of the resource group
    -l, --lb-name <lb-name>                the name of the load balancer
    -s, --subscription <subscription>      the subscription identifier
    network lb probe delete [options] <resource-group> <lb-name> <name>

删除为负载均衡器创建的探测。Removes the probe created for the load balancer.

    azure network lb probe delete -g myresourcegroup -l mylb -n mylbprobe

    info:    Executing command network lb probe delete
    + Looking up the load balancer "mylb"
    Delete a probe "mylbprobe?" [y/n] y
    + Updating load balancer "mylb"
    info:    network lb probe delete command OK

用于管理负载均衡器前端 IP 配置的命令Commands to manage frontend ip configurations of a load balancer

    network lb frontend-ip create [options] <resource-group> <lb-name> <name>

为现有的负载均衡器集创建前端 IP 配置。Creates a frontend IP configuration to an existing load balancer set.

    azure network lb frontend-ip create -g myresourcegroup --lb-name mylb -n myfrontendip -o Dynamic -e subnet -m newvnet

    info:    Executing command network lb frontend-ip create
    + Looking up the load balancer "mylb"
    + Looking up the subnet "subnet"
    + Creating frontend IP configuration "myfrontendip"
    + Looking up the load balancer "mylb"
    data:    Id:                           /subscriptions/###############################/resourceGroups/Myresourcegroup/providers/Microsoft.Network/loadBalancers/mylb
    /frontendIPConfigurations/myfrontendip
    data:    Name:                         myfrontendip
    data:    Type:                         Microsoft.Network/loadBalancers/frontendIPConfigurations
    data:    Provisioning state:           Succeeded
    data:    Private IP allocation method: Dynamic
    data:    Private IP address:           10.0.1.4
    data:    Subnet:                       id=/subscriptions/###############################/resourceGroups/myresourcegroup/providers/Microsoft.Network/virtualNetworks/newvnet/subnets/subnet
    data:    Public IP address:
    data:    Inbound NAT rules
    data:    Outbound NAT rules
    data:    Load balancing rules
    data:
    info:    network lb frontend-ip create command OK

    network lb frontend-ip set [options] <resource-group> <lb-name> <name>

更新前端 IP 配置的现有配置。以下命令将名为 mypubip5 的公共 IP 添加到名为 myfrontendip 的现有负载均衡器前端 IP。Updates an existing configuration of a frontend IP.The command below adds a public IP called mypubip5 to an existing load balancer frontend IP named myfrontendip.

    azure network lb frontend-ip set -g myresourcegroup --lb-name mylb -n myfrontendip -i mypubip5

    info:    Executing command network lb frontend-ip set
    + Looking up the load balancer "mylb"
    + Looking up the public ip "mypubip5"
    + Updating load balancer "mylb"
    + Looking up the load balancer "mylb"
    data:    Id:                           /subscriptions/###############################/resourceGroups/myresourcegroup/providers/Microsoft.Network/loadBalancers/mylb/frontendIPConfigurations/myfrontendip
    data:    Name:                         myfrontendip
    data:    Type:                         Microsoft.Network/loadBalancers/frontendIPConfigurations
    data:    Provisioning state:           Succeeded
    data:    Private IP allocation method: Dynamic
    data:    Private IP address:
    data:    Subnet:
    data:    Public IP address:            id=/subscriptions/###############################/resourceGroups/myresourcegroup/providers/Microsoft.Network/publicIPAddresses/mypubip5
    data:    Inbound NAT rules
    data:    Outbound NAT rules
    data:    Load balancing rules
    data:
    info:    network lb frontend-ip set command OK

参数选项:Parameter options:

    -h, --help                                                         output usage information
    -v, --verbose                                                      use verbose output
    --json                                                             use json output
    -g, --resource-group <resource-group>                              the name of the resource group
    -l, --lb-name <lb-name>                                            the name of the load balancer
    -n, --name <name>                                                  the name of the frontend ip configuration
    -a, --private-ip-address <private-ip-address>                      the private ip address
    -o, --private-ip-allocation-method <private-ip-allocation-method>  the private ip allocation method [Static, Dynamic]
    -u, --public-ip-id <public-ip-id>                                  the public ip identifier.
    e.g. /subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Network/publicIPAddresses/<public-ip-name>
    -i, --public-ip-name <public-ip-name>                              the public ip name.
    This public ip must exist in the same resource group as the lb.
    Please use public-ip-id if that is not the case.
    -b, --subnet-id <subnet-id>                                        the subnet id.
    e.g. /subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Network/VirtualNetworks/<vnet-name>/subnets/<subnet-name>
    -e, --subnet-name <subnet-name>                                    the subnet name
    -m, --vnet-name <vnet-name>                                        the virtual network name.
    This virtual network must exist in the same resource group as the lb.
    Please use subnet-id if that is not the case.
    -s, --subscription <subscription>                                  the subscription identifier

    network lb frontend-ip list [options] <resource-group> <lb-name>

列出针对负载均衡器配置的所有前端 IP 资源。Lists all the frontend IP resources configured for the load balancer.

    azure network lb frontend-ip list -g myresourcegroup -l mylb

    info:    Executing command network lb frontend-ip list
    + Looking up the load balancer "mylb"
    data:    Name         Provisioning state  Private IP allocation method  Subnet
    data:    -----------  ------------------  ----------------------------  ------
    data:    myprivateip  Succeeded           Dynamic
    info:    network lb frontend-ip list command OK

参数选项:Parameter options:

    -h, --help                             output usage information
    -v, --verbose                          use verbose output
    --json                                 use json output
    -g, --resource-group <resource-group>  the name of the resource group
    -l, --lb-name <lb-name>                the name of the load balancer
    -s, --subscription <subscription>      the subscription identifier

    network lb frontend-ip delete [options] <resource-group> <lb-name> <name>

删除与负载均衡器关联的前端 IP 对象Deletes the frontend IP object associated to load balancer

    network lb frontend-ip delete -g myresourcegroup -l mylb -n myfrontendip
    info:    Executing command network lb frontend-ip delete
    + Looking up the load balancer "mylb"
    Delete frontend ip configuration "myfrontendip"? [y/n] y
    + Updating load balancer "mylb"

参数选项:Parameter options:

    -h, --help                             output usage information
    -v, --verbose                          use verbose output
    --json                                 use json output
    -g, --resource-group <resource-group>  the name of the resource group
    -l, --lb-name <lb-name>                the name of the load balancer
    -n, --name <name>                      the name of the frontend ip configuration
    -q, --quiet                            quiet mode, do not ask for delete confirmation
    -s, --subscription <subscription>      the subscription identifier

用于管理负载均衡器后端地址池的命令Commands to manage backend address pools of a load balancer

    network lb address-pool create [options] <resource-group> <lb-name> <name>

为负载均衡器创建后端地址池。Create a backend address pool for a load balancer.

    azure network lb address-pool create -g myresourcegroup --lb-name mylb -n myaddresspool

    info:    Executing command network lb address-pool create
    + Looking up the load balancer "mylb"
    + Updating load balancer "mylb"
    + Looking up the load balancer "mylb"
    data:    Id:                        /subscriptions/###############################/resourceGroups/myresourgroup/providers/Microso.Network/loadBalancers/mylb/backendAddressPools/myaddresspool
    data:    Name:                      myaddresspool
    data:    Type:                      Microsoft.Network/loadBalancers/backendAddressPools
    data:    Provisioning state:        Succeeded
    data:    Backend IP configurations:
    data:    Load balancing rules:
    data:
    info:    network lb address-pool create command OK

参数选项:Parameter options:

    -h, --help                             output usage information
    -v, --verbose                          use verbose output
    --json                                 use json output
    -g, --resource-group <resource-group>  the name of the resource group
    -l, --lb-name <lb-name>                the name of the load balancer
    -n, --name <name>                      the name of the backend address pool
    -s, --subscription <subscription>      the subscription identifier

    network lb address-pool list [options] <resource-group> <lb-name>

列出特定资源组的后端 IP 地址池范围List backend IP address pool range for a specific resource group

    azure network lb address-pool list -g myresourcegroup -l mylb

    info:    Executing command network lb address-pool list
    + Looking up the load balancer "mylb"
    data:    Name           Provisioning state
    data:    -------------  ------------------
    data:    mybackendpool  Succeeded
    info:    network lb address-pool list command OK

参数选项:Parameter options:

     -h, --help                             output usage information
     -v, --verbose                          use verbose output
     --json                                 use json output
     -g, --resource-group <resource-group>  the name of the resource group
     -l, --lb-name <lb-name>                the name of the load balancer
     -s, --subscription <subscription>      the subscription identifier

    network lb address-pool delete [options] <resource-group> <lb-name> <name>

从负载均衡器中删除后端 IP 池范围资源。Removes the backend IP pool range resource from load balancer.

    azure network lb address-pool delete -g myresourcegroup -l mylb -n mybackendpool

    info:    Executing command network lb address-pool delete
    + Looking up the load balancer "mylb"
    Delete backend address pool "mybackendpool"? [y/n] y
    + Updating load balancer "mylb"
    info:    network lb address-pool delete command OK

参数选项:Parameter options:

    -h, --help                             output usage information
    -v, --verbose                          use verbose output
    --json                                 use json output
    -g, --resource-group <resource-group>  the name of the resource group
    -l, --lb-name <lb-name>                the name of the load balancer
    -n, --name <name>                      the name of the backend address pool
    -q, --quiet                            quiet mode, do not ask for delete confirmation
    -s, --subscription <subscription>      the subscription identifier

用于管理负载均衡器规则的命令Commands to manage load balancer rules

    network lb rule create [options] <resource-group> <lb-name> <name>

创建负载均衡器规则。Create load balancer rules.

可创建负载均衡器规则,用于配置负载均衡器的前端终结点以及要接收传入网络流量的后端地址池范围。You can create a load balancer rule configuring the frontend endpoint for the load balancer and the backend address pool range to receive the incoming network traffic. 设置还包括前端 IP 终结点的端口,以及后端地址池范围的端口。Settings also include the ports for frontend IP endpoint and ports for the backend address pool range.

下例演示了如何创建负载均衡器规则、侦听端口 80 TCP 的前端终结点,以及发送到后端地址池范围的端口 8080 的负载均衡网络流量。The following example shows how to create a load balancer rule, the frontend endpoint listening to port 80 TCP and load balancing network traffic sending to port 8080 for the backend address pool range.

    azure network lb rule create -g myresourcegroup -l mylb -n mylbrule -p tcp -f 80 -b 8080 -i 10

    info:    Executing command network lb rule create
    + Looking up the load balancer "mylb"
    + Updating load balancer "mylb"
    + Loading rule state
    data:    Id:                        /subscriptions/###############################/resourceGroups/myresourcegroup/providers/Microsoft.Network/loadBalancers/mylb/loadBalancingRules/mylbrule
    data:    Name:                      mylbrule
    data:    Type:                      Microsoft.Network/loadBalancers/loadBalancingRules
    data:    Provisioning state:        Succeeded
    data:    Frontend IP configuration: /subscriptions/###############################/resourceGroups/myresourcegroup/providers/Microsoft.Network/loadBalancers/mylb/frontendIPConfigurations/myfrontendip
    data:    Backend address pool:      id=/subscriptions/###############################/resourceGroups/myresourcegroup/providers/Microsoft.Network/loadBalancers/mylb/backendAddressPools/mybackendpool
    data:    Protocol:                  Tcp
    data:    Frontend port:             80
    data:    Backend port:              8080
    data:    Enable floating IP:        false
    data:    Idle timeout in minutes:   10
    data:    Probes
    data:
    info:    network lb rule create command OK

    network lb rule set [options] <resource-group> <lb-name> <name>

更新特定资源组中设置的现有负载均衡器规则。Updates an existing load balancer rule set in a specific resource group. 在以下示例中,我们已将规则名称从 mylbrule 更改为 mynewlbrule。In the following example, we changed the rule name from mylbrule to mynewlbrule.

    azure network lb rule set -g myresourcegroup -l mylb -n mylbrule -r mynewlbrule -p tcp -f 80 -b 8080 -i 10 -t myfrontendip -o mybackendpool

    info:    Executing command network lb rule set
    + Looking up the load balancer "mylb"
    + Updating load balancer "mylb"
    + Loading rule state
    data:    Id:                        /subscriptions/###############################/resourceGroups/yresourcegroup/providers/Microsoft.Network/loadBalancers/mylb/loadBalancingRules/mynewlbrule
    data:    Name:                      mynewlbrule
    data:    Type:                      Microsoft.Network/loadBalancers/loadBalancingRules
    data:    Provisioning state:        Succeeded
    data:    Frontend IP configuration: /subscriptions/###############################/resourceGroups/yresourcegroup/providers/Microsoft.Network/loadBalancers/mylb/frontendIPConfigurations/myfrontendip
    data:    Backend address pool:      id=/subscriptions/###############################/resourceGroups/yresourcegroup/providers/Microsoft.Network/loadBalancers/mylb/backendAddressPools/mybackendpool
    data:    Protocol:                  Tcp
    data:    Frontend port:             80
    data:    Backend port:              8080
    data:    Enable floating IP:        false
    data:    Idle timeout in minutes:   10
    data:    Probes
    data:
    info:    network lb rule set command OK

参数选项:Parameter options:

    -h, --help                                         output usage information
    -v, --verbose                                      use verbose output
    --json                                             use json output
    -g, --resource-group <resource-group>              the name of the resource group
    -l, --lb-name <lb-name>                            the name of the load balancer
    -n, --name <name>                                  the name of the rule
    -r, --new-rule-name <new-rule-name>                new rule name
    -p, --protocol <protocol>                          the rule protocol
    -f, --frontend-port <frontend-port>                the frontend port
    -b, --backend-port <backend-port>                  the backend port
    -e, --enable-floating-ip <enable-floating-ip>      enable floating point ip
    -i, --idle-timeout <idle-timeout>                  the idle timeout in minutes
    -a, --probe-name [probe-name]                      the name of the probe defined in the same load balancer
    -t, --frontend-ip-name <frontend-ip-name>          the name of the frontend ip configuration in the same load balancer
    -o, --backend-address-pool <backend-address-pool>  name of the backend address pool defined in the same load balancer
    -s, --subscription <subscription>                  the subscription identifier
    network lb rule list [options] <resource-group> <lb-name>

列出针对特定资源组中某个负载均衡器配置的所有负载均衡器规则。Lists all load balancer rules configured for a load balancer in a specific resource group.

    azure network lb rule list -g myresourcegroup -l mylb

    info:    Executing command network lb rule list
    + Looking up the load balancer "mylb"
    data:    Name         Provisioning state  Protocol  Frontend port  Backend port  Enable floating IP  Idle timeout in minutes  Backend address pool  Probe data

    data:    mynewlbrule  Succeeded           Tcp       80             8080          false               10                       /subscriptions/###############################/resourceGroups/myresourcegroup/providers/Microsoft.Network/loadBalancers/mylb/backendAddressPools/mybackendpool
    info:    network lb rule list command OK

参数选项:Parameter options:

    -h, --help                             output usage information
    -v, --verbose                          use verbose output
    --json                                 use json output
    -g, --resource-group <resource-group>  the name of the resource group
    -l, --lb-name <lb-name>                the name of the load balancer
    -s, --subscription <subscription>      the subscription identifier
    network lb rule delete [options] <resource-group> <lb-name> <name>

删除负载均衡器规则。Deletes a load balancer rule.

    azure network lb rule delete -g myresourcegroup -l mylb -n mynewlbrule

    info:    Executing command network lb rule delete
    + Looking up the load balancer "mylb"
    Delete load balancing rule mynewlbrule? [y/n] y
    + Updating load balancer "mylb"
    info:    network lb rule delete command OK

参数选项:Parameter options:

    -h, --help                             output usage information
    -v, --verbose                          use verbose output
    --json                                 use json output
    -g, --resource-group <resource-group>  the name of the resource group
    -l, --lb-name <lb-name>                the name of the load balancer
    -n, --name <name>                      the name of the rule
    -q, --quiet                            quiet mode, do not ask for delete confirmation
    -s, --subscription <subscription>      the subscription identifier

用于管理负载均衡器入站 NAT 规则的命令Commands to manage load balancer inbound NAT rules

    network lb inbound-nat-rule create [options] <resource-group> <lb-name> <name>

为负载均衡器创建入站 NAT 规则。Creates an inbound NAT rule for load balancer.

下例中我们从前端 IP 创建了一个 NAT 规则(之前已使用“azure network frontend-ip”进行定义),其中包含一个入站侦听端口和负载均衡器用于发送网络流量的出站端口。In the following example we created a NAT rule from frontend IP (which was previously defined using the "azure network frontend-ip" command) with an inbound listening port and outbound port that the load balancer uses to send the network traffic.

    azure network lb inbound-nat-rule create -g myresourcegroup -l mylb -n myinboundnat -p tcp -f 80 -b 8080 -i myfrontendip

    info:    Executing command network lb inbound-nat-rule create
    + Looking up the load balancer "mylb"
    + Updating load balancer "mylb"
    + Looking up the load balancer "mylb"
    data:    Id:                        /subscriptions/###############################/resourceGroups/myresourcegroup/providers/Microsoft.Network/loadBalancers/mylb/inboundNatRules/myinboundnat
    data:    Name:                      myinboundnat
    data:    Type:                      Microsoft.Network/loadBalancers/inboundNatRules
    data:    Provisioning state:        Succeeded
    data:    Frontend IP Configuration: id=/subscriptions/###############################/resourceGroups/myresourcegroup/providers/Microsoft.Network/loadBalancers/mylb/frontendIPConfigurations/myfrontendip
    data:    Backend IP configuration
    data:    Protocol                   Tcp
    data:    Frontend port              80
    data:    Backend port               8080
    data:    Enable floating IP         false
    info:    network lb inbound-nat-rule create command OK

参数选项:Parameter options:

    -h, --help                                     output usage information
    -v, --verbose                                  use verbose output
    --json                                         use json output
    -g, --resource-group <resource-group>          the name of the resource group
    -l, --lb-name <lb-name>                        the name of the load balancer
    -n, --name <name>                              the name of the inbound NAT rule
    -p, --protocol <protocol>                      the rule protocol [tcp,udp]
    -f, --frontend-port <frontend-port>            the frontend port [0-65535]
    -b, --backend-port <backend-port>              the backend port [0-65535]
    -e, --enable-floating-ip <enable-floating-ip>  enable floating point ip [true,false]
    -i, --frontend-ip <frontend-ip>                the name of the frontend ip configuration
    -m, --vm-id <vm-id>                            the VM id.
    e.g. /subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Compute/virtualMachines/<vm-name>
    -a, --vm-name <vm-name>                        the VM name.This VM must exist in the same resource group as the lb.
    Please use vm-id if that is not the case.
    this parameter will be ignored if --vm-id is specified
    -s, --subscription <subscription>              the subscription identifier

    network lb inbound-nat-rule set [options] <resource-group> <lb-name> <name>

更新现有的入站 NAT 规则。Updates an existing inbound nat rule. 在以下示例中,我们已将入站侦听端口从 80 更改为 81。In the following example, we changed the inbound listening port from 80 to 81.

    azure network lb inbound-nat-rule set -g group-1 -l mylb -n myinboundnat -p tcp -f 81 -b 8080 -i myfrontendip

    info:    Executing command network lb inbound-nat-rule set
    + Looking up the load balancer "mylb"
    + Updating load balancer "mylb"
    + Looking up the load balancer "mylb"
    data:    Id:                        /subscriptions/###############################/resourceGroups/group-1/providers/Microsoft.Network/loadBalancers/mylb/inboundNatRules/myinboundnat
    data:    Name:                      myinboundnat
    data:    Type:                      Microsoft.Network/loadBalancers/inboundNatRules
    data:    Provisioning state:        Succeeded
    data:    Frontend IP Configuration: id=/subscriptions/###############################/resourceGroups/group-1/providers/Microsoft.Network/loadBalancers/mylb/frontendIPConfigurations/myfrontendip
    data:    Backend IP configuration
    data:    Protocol                   Tcp
    data:    Frontend port              81
    data:    Backend port               8080
    data:    Enable floating IP         false
    info:    network lb inbound-nat-rule set command OK

参数选项:Parameter options:

    -h, --help                                     output usage information
    -v, --verbose                                  use verbose output
    --json                                         use json output
    -g, --resource-group <resource-group>          the name of the resource group
    -l, --lb-name <lb-name>                        the name of the load balancer
    -n, --name <name>                              the name of the inbound NAT rule
    -p, --protocol <protocol>                      the rule protocol [tcp,udp]
    -f, --frontend-port <frontend-port>            the frontend port [0-65535]
    -b, --backend-port <backend-port>              the backend port [0-65535]
    -e, --enable-floating-ip <enable-floating-ip>  enable floating point ip [true,false]
    -i, --frontend-ip <frontend-ip>                the name of the frontend ip configuration
    -m, --vm-id [vm-id]                            the VM id.
    e.g. /subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Compute/virtualMachines/<vm-name>
    -a, --vm-name <vm-name>                        the VM name.
    This virtual machine must exist in the same resource group as the lb.
    Please use vm-id if that is not the case
    -s, --subscription <subscription>              the subscription identifier

    network lb inbound-nat-rule list [options] <resource-group> <lb-name>

列出负载均衡器的所有入站 NAT 规则。Lists all inbound nat rules for load balancer.

    azure network lb inbound-nat-rule list -g myresourcegroup -l mylb

    info:    Executing command network lb inbound-nat-rule list
    + Looking up the load balancer "mylb"
    data:    Name          Provisioning state  Protocol  Frontend port  Backend port  Enable floating IP  Idle timeout in minutes  Backend IP configuration
    data:    ------------  ------------------  --------  -------------  ------------  ------------------  -----------------------  ---    ---------------------
    data:    myinboundnat  Succeeded           Tcp       81             8080          false               4

    info:    network lb inbound-nat-rule list command OK

参数选项:Parameter options:

    -h, --help                             output usage information
    -v, --verbose                          use verbose output
    --json                                 use json output
    -g, --resource-group <resource-group>  the name of the resource group
    -l, --lb-name <lb-name>                the name of the load balancer
    -s, --subscription <subscription>      the subscription identifier

    network lb inbound-nat-rule delete [options] <resource-group> <lb-name> <name>

删除特定资源组中负载均衡器的 NAT 规则。Deletes NAT rule for the load balancer in a specific resource group.

    azure network lb inbound-nat-rule delete -g myresourcegroup -l mylb -n myinboundnat

    info:    Executing command network lb inbound-nat-rule delete
    + Looking up the load balancer "mylb"
    Delete inbound NAT rule "myinboundnat?" [y/n] y
    + Updating load balancer "mylb"
    info:    network lb inbound-nat-rule delete command OK

参数选项:Parameter options:

    -h, --help                             output usage information
    -v, --verbose                          use verbose output
    --json                                 use json output
    -g, --resource-group <resource-group>  the name of the resource group
    -l, --lb-name <lb-name>                the name of the load balancer
    -n, --name <name>                      the name of the inbound NAT rule
    -q, --quiet                            quiet mode, do not ask for delete confirmation
    -s, --subscription <subscription>      the subscription identifier

用于管理公共 IP 地址的命令Commands to manage public ip addresses

    network public-ip create [options] <resource-group> <name> <location>

创建公共 IP 资源。Creates a public ip resource. 将要创建公共 IP 资源并将其关联到一个域名。You will create the public ip resource and associate to a domain name.

    azure network public-ip create -g myresourcegroup -n mytestpublicip1 -l chinaeast -d azureclitest -a "Dynamic"
    info:    Executing command network public-ip create
    + Looking up the public ip "mytestpublicip1"
    + Creating public ip address "mytestpublicip1"
    + Looking up the public ip "mytestpublicip1"
    data:    Id:                   /subscriptions/###############################/resourceGroups/myresourcegroup/providers/Microsoft.Network/publicIPAddresses/mytestpublicip1
    data:    Name:                 mytestpublicip1
    data:    Type:                 Microsoft.Network/publicIPAddresses
    data:    Location:             chinaeast
    data:    Provisioning state:   Succeeded
    data:    Allocation method:    Dynamic
    data:    Idle timeout:         4
    data:    Domain name label:    azureclitest
    data:    FQDN:                 azureclitest.chinaeast.cloudapp.chinacloudapi.cn
    info:    network public-ip create command OK

参数选项:Parameter options:

    -h, --help                                   output usage information
    -v, --verbose                                use verbose output
    --json                                       use json output
    -g, --resource-group <resource-group>        the name of the resource group
    -n, --name <name>                            the name of the public ip
    -l, --location <location>                    the location
    -d, --domain-name-label <domain-name-label>  the domain name label.
    This set DNS to <domain-name-label>.<location>.cloudapp.chinacloudapi.cn
    -a, --allocation-method <allocation-method>  the allocation method [Static][Dynamic]
    -i, --idletimeout <idletimeout>              the idle timeout in minutes
    -f, --reverse-fqdn <reverse-fqdn>            the reverse fqdn
    -t, --tags <tags>                            the list of tags.
    Can be multiple. In the format of "name=value".
    Name is required and value is optional.
    For example, -t tag1=value1;tag2
    -s, --subscription <subscription>            the subscription identifier

    network public-ip set [options] <resource-group> <name>

更新现有的公共 IP 资源的属性。Updates the properties of an existing public ip resource. 在以下示例中,我们已将公共 IP 地址从动态更改为静态。In the following example we changed the public IP address from Dynamic to Static.

    azure network public-ip set -g group-1 -n mytestpublicip1 -d azureclitest -a "Static"
    info:    Executing command network public-ip set
    + Looking up the public ip "mytestpublicip1"
    + Updating public ip address "mytestpublicip1"
    + Looking up the public ip "mytestpublicip1"
    data:    Id:                   /subscriptions/###############################/resourceGroups/myresourcegroup/providers/Microsoft.Network/publicIPAddresses/mytestpublicip1
    data:    Name:                 mytestpublicip1
    data:    Type:                 Microsoft.Network/publicIPAddresses
    data:    Location:             chinaeast
    data:    Provisioning state:   Succeeded
    data:    Allocation method:    Static
    data:    Idle timeout:         4
    data:    IP Address:           (static IP address)
    data:    Domain name label:    azureclitest
    data:    FQDN:                 azureclitest.chinaeast.cloudapp.chinacloudapi.cn
    info:    network public-ip set command OK

参数选项:Parameter options:

    -h, --help                                   output usage information
    -v, --verbose                                use verbose output
    --json                                       use json output
    -g, --resource-group <resource-group>        the name of the resource group
    -n, --name <name>                            the name of the public ip
    -d, --domain-name-label [domain-name-label]  the domain name label.
    This set DNS to <domain-name-label>.<location>.cloudapp.chinacloudapi.cn
    -a, --allocation-method <allocation-method>  the allocation method [Static][Dynamic]
    -i, --idletimeout <idletimeout>              the idle timeout in minutes
    -f, --reverse-fqdn [reverse-fqdn]            the reverse fqdn
    -t, --tags <tags>                            the list of tags.
    Can be multiple. In the format of "name=value".
    Name is required and value is optional.
    For example, -t tag1=value1;tag2
    --no-tags                                    remove all existing tags
    -s, --subscription <subscription>            the subscription identifier

    network public-ip list [options] <resource-group>

列出资源组中的所有公共 IP 资源。Lists all public IP resources within a resource group.

    azure network public-ip list -g myresourcegroup

    info:    Executing command network public-ip list
    + Getting the public ip addresses
    data:    Name             Location  Allocation  IP Address    Idle timeout  DNS Name
    data:    ---------------  --------  ----------  ------------  ------------  -------------------------------------------
    data:    mypubip5         chinanorth    Dynamic                   4             "domain name".chinanorth.cloudapp.chinacloudapi.cn
    data:    myPublicIP       chinaeast    Dynamic                   4             "domain name".chinaeast.cloudapp.chinacloudapi.cn
    data:    mytestpublicip   chinaeast    Dynamic                   4             "domain name".chinaeast.cloudapp.chinacloudapi.cn
    data:    mytestpublicip1  chinaeast   Static (Static IP address) 4             azureclitest.chinaeast.cloudapp.chinacloudapi.cn

参数选项:Parameter options:

    -h, --help                             output usage information
    -v, --verbose                          use verbose output
    --json                                 use json output
    -g, --resource-group <resource-group>  the name of the resource group
    -s, --subscription <subscription>      the subscription identifier

    network public-ip show [options] <resource-group> <name>

显示资源组中公共 IP 资源的公共 IP 属性。Displays public ip properties for a public ip resource within a resource group.

    azure network public-ip show -g myresourcegroup -n mytestpublicip

    info:    Executing command network public-ip show
    + Looking up the public ip "mytestpublicip1"
    data:    Id:                   /subscriptions/###############################/resourceGroups/myresourcegroup/providers/Microsoft.Network/publicIPAddresses/mytestpublicip
    data:    Name:                 mytestpublicip
    data:    Type:                 Microsoft.Network/publicIPAddresses
    data:    Location:             chinaeast
    data:    Provisioning state:   Succeeded
    data:    Allocation method:    Static
    data:    Idle timeout:         4
    data:    IP Address:           (static IP address)
    data:    Domain name label:    azureclitest
    data:    FQDN:                 azureclitest.chinaeast.cloudapp.chinacloudapi.cn
    info:    network public-ip show command OK

参数选项:Parameter options:

    -h, --help                             output usage information
    -v, --verbose                          use verbose output
    --json                                 use json output
    -g, --resource-group <resource-group>  the name of the resource group
    -n, --name <name>                      the name of the public IP
    -s, --subscription <subscription>      the subscription identifier
    network public-ip delete [options] <resource-group> <name>

删除公共 IP 资源。Deletes public ip resource.

    azure network public-ip delete -g group-1 -n mypublicipname
    info:    Executing command network public-ip delete
    + Looking up the public ip "mypublicipname"
    Delete public ip address "mypublicipname"? [y/n] y
    + Deleting public ip address "mypublicipname"
    info:    network public-ip delete command OK

参数选项:Parameter options:

    -h, --help                             output usage information
    -v, --verbose                          use verbose output
    --json                                 use json output
    -g, --resource-group <resource-group>  the name of the resource group
    -n, --name <name>                      the name of the public IP
    -q, --quiet                            quiet mode, do not ask for delete confirmation
    -s, --subscription <subscription>      the subscription identifier

用于管理网络接口的命令Commands to manage network interfaces

    network nic create [options] <resource-group> <name> <location>

创建可用于负载均衡器或关联到虚拟机的名为网络接口 (NIC) 的资源。Creates a resource called network interface (NIC) which can be used for load balancers or associate to a Virtual Machine.

    azure network nic create -g myresourcegroup -l chinaeast -n testnic1 --subnet-name subnet-1 --subnet-vnet-name myvnet

    info:    Executing command network nic create
    + Looking up the network interface "testnic1"
    + Looking up the subnet "subnet-1"
    + Creating network interface "testnic1"
    + Looking up the network interface "testnic1"
    data:    Id:                     /subscriptions/c4a17ddf-aa84-491c-b6f9-b90d882299f7/resourceGroups/group-1/providers/Microsoft.Network/networkInterfaces/testnic1
    data:    Name:                   testnic1
    data:    Type:                   Microsoft.Network/networkInterfaces
    data:    Location:               chinaeast
    data:    Provisioning state:     Succeeded
    data:    IP configurations:
    data:       Name:                         NIC-config
    data:       Provisioning state:           Succeeded
    data:       Private IP address:           10.0.0.5
    data:       Private IP Allocation Method: Dynamic
    data:       Subnet:                       /subscriptions/c4a17ddf-aa84-491c-b6f9-b90d882299f7/resourceGroups/group-1/providers/Microsoft.Network/virtualNetworks/myVNET/subnets/Subnet-1

参数选项:Parameter options:

    -h, --help                                                       output usage information
    -v, --verbose                                                    use verbose output
    --json                                                           use json output
    -g, --resource-group <resource-group>                            the name of the resource group
    -n, --name <name>                                                the name of the network interface
    -l, --location <location>                                        the location
    -w, --network-security-group-id <network-security-group-id>      the network security group identifier.
    e.g. /subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Network/networkSecurityGroups/<nsg-name>
    -o, --network-security-group-name <network-security-group-name>  the network security group name.
    This network security group must exist in the same resource group as the nic.
    Please use network-security-group-id if that is not the case.
    -i, --public-ip-id <public-ip-id>                                the public IP identifier.
    e.g. /subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Network/publicIPAddresses/<public-ip-name>
    -p, --public-ip-name <public-ip-name>                            the public IP name.
    This public ip must exist in the same resource group as the nic.
    Please use public-ip-id if that is not the case.
    -a, --private-ip-address <private-ip-address>                    the private IP address
    -u, --subnet-id <subnet-id>                                      the subnet identifier.
    e.g. /subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Network/virtualNetworks/<vnet-name>/subnets/<subnet-name>
    --subnet-name <subnet-name>                                  the subnet name
    -m, --subnet-vnet-name <subnet-vnet-name>                        the vnet name under which subnet-name exists
    -t, --tags <tags>                                                the comma separated list of tags.
    Can be multiple. In the format of "name=value".
    Name is required and value is optional.
    For example, -t tag1=value1;tag2
    -s, --subscription <subscription>                                the subscription identifier
    data:
    info:    network nic create command OK

    network nic set [options] <resource-group> <name>
    network nic list [options] <resource-group>
    network nic show [options] <resource-group> <name>
    network nic delete [options] <resource-group> <name>

用于管理网络安全组的命令Commands to manage network security groups

    network nsg create [options] <resource-group> <name> <location>
    network nsg set [options] <resource-group> <name>
    network nsg list [options] <resource-group>
    network nsg show [options] <resource-group> <name>
    network nsg delete [options] <resource-group> <name>

用于管理网络安全组规则的命令Commands to manage network security group rules

    network nsg rule create [options] <resource-group> <nsg-name> <name>
    network nsg rule set [options] <resource-group> <nsg-name> <name>
    network nsg rule list [options] <resource-group> <nsg-name>
    network nsg rule show [options] <resource-group> <nsg-name> <name>
    network nsg rule delete [options] <resource-group> <nsg-name> <name>

用于管理流量管理器配置文件的命令Commands to manage traffic manager profile

    network traffic-manager profile create [options] <resource-group> <name>
    network traffic-manager profile set [options] <resource-group> <name>
    network traffic-manager profile list [options] <resource-group>
    network traffic-manager profile show [options] <resource-group> <name>
    network traffic-manager profile delete [options] <resource-group> <name>
    network traffic-manager profile is-dns-available [options] <resource-group> <relative-dns-name>

用于管理流量管理器终结点的命令Commands to manage traffic manager endpoints

    network traffic-manager profile endpoint create [options] <resource-group> <profile-name> <name> <endpoint-location>
    network traffic-manager profile endpoint set [options] <resource-group> <profile-name> <name>
    network traffic-manager profile endpoint delete [options] <resource-group> <profile-name> <name>

用于管理虚拟网络网关的命令Commands to manage virtual network gateways

    network gateway list [options] <resource-group>

资源提供程序注册Resource provider registrations

列出 Resource Manager 中当前已注册的提供程序List currently registered providers in Resource Manager

    provider list [options]

显示有关请求的提供程序命名空间的详细信息Show details about the requested provider namespace

    provider show [options] <namespace>

将提供程序注册到订阅Register provider with the subscription

    provider register [options] <namespace>

从订阅中取消注册提供程序Unregister provider with the subscription

    provider unregister [options] <namespace>

资源Resources

在资源组中创建资源Creates a resource in a resource group

    resource create [options] <resource-group> <name> <resource-type> <location> <api-version>

更新资源组中不带任何模板或参数的资源Updates a resource in a resource group without any templates or parameters

    resource set [options] <resource-group> <name> <resource-type> <properties> <api-version>

列出资源Lists the resources

    resource list [options] [resource-group]

获取资源组或订阅中的一个资源Gets one resource within a resource group or subscription

    resource show [options] <resource-group> <name> <resource-type> <api-version>

删除资源组中的资源Deletes a resource in a resource group

    resource delete [options] <resource-group> <name> <resource-type> <api-version>

Azure 角色Azure roles

获取所有可用的角色定义Get all available role definitions

    role list [options]

获取一个可用的角色定义Get an available role definition

    role show [options] [name]

用于管理角色分配的命令Commands to manage your role assignment

    role assignment create [options] [objectId] [upn] [mail] [spn] [role] [scope] [resource-group] [resource-type] [resource-name]
    role assignment list [options] [objectId] [upn] [mail] [spn] [role] [scope] [resource-group] [resource-type] [resource-name]
    role assignment delete [options] [objectId] [upn] [mail] [spn] [role] [scope] [resource-group] [resource-type] [resource-name]

存储对象Storage objects

用于管理存储帐户的命令Commands to manage your Storage accounts

    storage account list [options]
    storage account show [options] <name>
    storage account create [options] <name>
    storage account set [options] <name>
    storage account delete [options] <name>

用于管理存储帐户密钥的命令Commands to manage your Storage account keys

    storage account keys list [options] <name>
    storage account keys renew [options] <name>

用于显示存储连接字符串的命令Commands to show your Storage connection string

    storage account connectionstring show [options] <name>

用于管理存储容器的命令Commands to manage your Storage containers

    storage container list [options] [prefix]
    storage container show [options] [container]
    storage container create [options] [container]
    storage container delete [options] [container]
    storage container set [options] [container]

用于管理存储容器的共享访问签名的命令Commands to manage shared access signatures of your Storage container

    storage container sas create [options] [container] [permissions] [expiry]

用于管理存储容器的存储访问策略的命令Commands to manage stored access policies of your Storage container

    storage container policy create [options] [container] [name]
    storage container policy show [options] [container] [name]
    storage container policy list [options] [container]
    storage container policy set [options] [container] [name]
    storage container policy delete [options] [container] [name]

用于管理存储 Blob 的命令Commands to manage your Storage blobs

    storage blob list [options] [container] [prefix]
    storage blob show [options] [container] [blob]
    storage blob delete [options] [container] [blob]
    storage blob upload [options] [file] [container] [blob]
    storage blob download [options] [container] [blob] [destination]

用于管理 Blob 复制操作的命令Commands to manage your blob copy operations

    storage blob copy start [options] [sourceUri] [destContainer]
    storage blob copy show [options] [container] [blob]
    storage blob copy stop [options] [container] [blob] [copyid]

用于管理存储 Blob 的共享访问签名的命令Commands to manage shared access signature of your Storage blob

    storage blob sas create [options] [container] [blob] [permissions] [expiry]

用于管理存储文件共享的命令Commands to manage your Storage file shares

    storage share create [options] [share]
    storage share show [options] [share]
    storage share delete [options] [share]
    storage share list [options] [prefix]

用于管理存储文件的命令Commands to manage your Storage files

    storage file list [options] [share] [path]
    storage file delete [options] [share] [path]
    storage file upload [options] [source] [share] [path]
    storage file download [options] [share] [path] [destination]

用于管理存储文件目录的命令Commands to manage your Storage file directory

    storage directory create [options] [share] [path]
    storage directory delete [options] [share] [path]

用于管理存储队列的命令Commands to manage your Storage queues

    storage queue create [options] [queue]
    storage queue list [options] [prefix]
    storage queue show [options] [queue]
    storage queue delete [options] [queue]

用于管理存储队列的共享访问签名的命令Commands to manage shared access signatures of your Storage queue

    storage queue sas create [options] [queue] [permissions] [expiry]

用于管理存储队列的存储访问策略的命令Commands to manage stored access policies of your Storage queue

    storage queue policy create [options] [queue] [name]
    storage queue policy show [options] [queue] [name]
    storage queue policy list [options] [queue]
    storage queue policy set [options] [queue] [name]
    storage queue policy delete [options] [queue] [name]

用于管理存储日志记录属性的命令Commands to manage your Storage logging properties

    storage logging show [options]
    storage logging set [options]

用于管理存储度量值属性的命令Commands to manage your Storage metrics properties

    storage metrics show [options]
    storage metrics set [options]

用于管理存储表的命令Commands to manage your Storage tables

    storage table create [options] [table]
    storage table list [options] [prefix]
    storage table show [options] [table]
    storage table delete [options] [table]

用于管理存储表的共享访问签名的命令Commands to manage shared access signatures of your Storage table

    storage table sas create [options] [table] [permissions] [expiry]

用于管理存储表的存储访问策略的命令Commands to manage stored access policies of your Storage table

    storage table policy create [options] [table] [name]
    storage table policy show [options] [table] [name]
    storage table policy list [options] [table]
    storage table policy set [options] [table] [name]
    storage table policy delete [options] [table] [name]

TagsTags

添加标记Add a tag

    tag create [options] <name> <value>

删除整个标记或标记值Remove an entire tag or a tag value

    tag delete [options] <name> <value>

列出标记信息Lists the tag information

    tag list [options]

获取标记Get a tag

    tag show [options] [name]

虚拟机Virtual Machines

创建 VMCreate a VM

    vm create [options] <resource-group> <name> <location> <os-type>

使用默认资源创建 VMCreate a VM with default resources

    vm quick-create [options] <resource-group> <name> <location> <os-type> <image-urn> <admin-username> <admin-password

提示

从 CLI 0.10 版开始,可以为某些热门市场映像提供“UbuntuLTS”或“Win2012R2Datacenter”之类的简短别名作为 image-urnStarting with CLI version 0.10, you can provide a short alias such as "UbuntuLTS" or "Win2012R2Datacenter" as the image-urn for some popular Marketplace images. 针对选项运行 azure help vm quick-createRun azure help vm quick-create for options. 另外,从版本 0.10 开始, azure vm quick-create 默认使用高级存储,前提是所选区域提供该存储。Additionally, starting with version 0.10, azure vm quick-create uses premium storage by default if it's available in the selected region.

列出帐户中的虚拟机List the virtual machines within an account

    vm list [options]

获取资源组中的一个虚拟机Get one virtual machine within a resource group

    vm show [options] <resource-group> <name>

删除资源组中的一个虚拟机Delete one virtual machine within a resource group

    vm delete [options] <resource-group> <name>

关闭资源组中的一个虚拟机Shutdown one virtual machine within a resource group

    vm stop [options] <resource-group> <name>

重新启动资源组中的一个虚拟机Restart one virtual machine within a resource group

    vm restart [options] <resource-group> <name>

启动资源组中的一个虚拟机Start one virtual machine within a resource group

    vm start [options] <resource-group> <name>

关闭资源组中的一个虚拟机并释放计算资源Shutdown one virtual machine within a resource group and releases the compute resources

    vm deallocate [options] <resource-group> <name>

列出可用的虚拟机大小List available virtual machine sizes

    vm sizes [options]

捕获用作 OS 映像或 VM 映像的 VMCapture the VM as OS Image or VM Image

    vm capture [options] <resource-group> <name> <vhd-name-prefix>

将 VM 的状态设置为通用化Set the state of the VM to Generalized

    vm generalize [options] <resource-group> <name>

获取 VM 的实例视图Get instance view of the VM

    vm get-instance-view [options] <resource-group> <name>

可让你重置虚拟机上的远程桌面访问或 SSH 设置,以及重置具有管理员或 sudo 权限的帐户的密码Enable 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

    vm reset-access [options] <resource-group> <name>

使用新数据更新 VMUpdate VM with new data

    vm set [options] <resource-group> <name>

用于管理虚拟机数据磁盘的命令Commands to manage your Virtual Machine data disks

    vm disk attach-new [options] <resource-group> <vm-name> <size-in-gb> [vhd-name]
    vm disk detach [options] <resource-group> <vm-name> <lun>
    vm disk attach [options] <resource-group> <vm-name> [vhd-url]

用于管理 VM 资源扩展的命令Commands to manage VM resource extensions

    vm extension set [options] <resource-group> <vm-name> <name> <publisher-name> <version>
    vm extension get [options] <resource-group> <vm-name>

用于管理 Docker 虚拟机的命令Commands to manage your Docker Virtual Machine

    vm docker create [options] <resource-group> <name> <location> <os-type>

用于管理 VM 映像的命令Commands to manage VM images

    vm image list-publishers [options] <location>
    vm image list-offers [options] <location> <publisher>
    vm image list-skus [options] <location> <publisher> <offer>
    vm image list [options] <location> <publisher> [offer] [sku]