Partilhar via


Get-AzVmss

Obtém as propriedades de um VMSS.

Syntax

Get-AzVmss
   [[-ResourceGroupName] <String>]
   [[-VMScaleSetName] <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzVmss
   [[-ResourceGroupName] <String>]
   [[-VMScaleSetName] <String>]
   [-InstanceView]
   [-UserData]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzVmss
   [[-ResourceGroupName] <String>]
   [[-VMScaleSetName] <String>]
   [-OSUpgradeHistory]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzVmss
   [-ResourceId <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

O cmdlet Get-AzVmss obtém a exibição de modelo e instância de um VMSS (Virtual Machine Scale set). A exibição de modelo é as propriedades especificadas pelo usuário do conjunto de escala da máquina virtual. A exibição de instância é o status de nível de instância do conjunto de escala da máquina virtual. Especifique o parâmetro InstanceView para obter apenas a exibição de instância de um conjunto de escala de máquina virtual.

Exemplos

Exemplo 1: Obter as propriedades de um VMSS

Get-AzVmss -ResourceGroupName "Group001" -VMScaleSetName "VMSS001"

ResourceGroupName                           : Group001
Sku                                         :
  Name                                      : Standard_DS1_v2
  Tier                                      : Standard
  Capacity                                  : 2
UpgradePolicy                               :
  Mode                                      : Manual
VirtualMachineProfile                       :
  OsProfile                                 :
    ComputerNamePrefix                      : test
    AdminUsername                           : contoso
    WindowsConfiguration                    :
      ProvisionVMAgent                      : True
      EnableAutomaticUpdates                : True
  StorageProfile                            :
    ImageReference                          :
      Publisher                             : MicrosoftWindowsServer
      Offer                                 : WindowsServer
      Sku                                   : 2016-Datacenter
      Version                               : latest
    OsDisk                                  :
      Caching                               : None
      CreateOption                          : FromImage
      ManagedDisk                           :
        StorageAccountType                  : Premium_LRS
  NetworkProfile                            :
    NetworkInterfaceConfigurations[0]       :
      Name                                  : Group001
      Primary                               : True
      EnableAcceleratedNetworking           : False
      NetworkSecurityGroup                  :
        Id                                  : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/Group001
/providers/Microsoft.Network/networkSecurityGroups/Group001
      DnsSettings                           :
      IpConfigurations[0]                   :
        Name                                : Group001
        Subnet                              :
          Id                                : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/group001
/providers/Microsoft.Network/virtualNetworks/Group001/subnets/Group001
        PrivateIPAddressVersion             : IPv4
        LoadBalancerBackendAddressPools[0]  :
          Id                                : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/group001
/providers/Microsoft.Network/loadBalancers/Group001/backendAddressPools/Group001
        LoadBalancerInboundNatPools[0]      :
          Id                                : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/group001
/providers/Microsoft.Network/loadBalancers/Group001/inboundNatPools/Group001
        LoadBalancerInboundNatPools[1]      :
          Id                                : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/group001
/providers/Microsoft.Network/loadBalancers/Group001/inboundNatPools/Group001
      EnableIPForwarding                    : False
ProvisioningState                           : Succeeded
Overprovision                               : True
UniqueId                                    : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
SinglePlacementGroup                        : False
Id                                          : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/Group001/
providers/Microsoft.Compute/virtualMachineScaleSets/VMSS001
Name                                        : VMSS001
Type                                        : Microsoft.Compute/virtualMachineScaleSets
Location                                    : eastus
Tags                                        : {}

Este comando obtém as propriedades do VMSS chamado VMSS001 que pertence ao grupo de recursos chamado Group001. Como o comando não especifica o parâmetro switch InstanceView , o cmdlet obtém a exibição de modelo do conjunto de escala da máquina virtual.

Exemplo 2: Obter todos os Vmss em um grupo de recursos

Get-AzVmss -ResourceGroupName "Group001"

ResourceGroupName                               Name       Location             Sku Capacity ProvisioningState
-----------------                               ----       --------             --- -------- -----------------
Group001                                       VMSS001      eastus Standard_DS1_v2        2         Succeeded
Group001                                       VMSS002      eastus     Standard_A1        2         Succeeded

Obter todos os Vmss no grupo de recursos "Group001"

Exemplo 3: Obter todos os Vmss em uma assinatura

Get-AzVmss

ResourceGroupName                               Name       Location             Sku Capacity ProvisioningState
-----------------                               ----       --------             --- -------- -----------------
Group001                                       VMSS001      eastus Standard_DS1_v2        2         Succeeded
Group001                                       VMSS002      eastus     Standard_A1        2         Succeeded
Group002                                       VMSS003      eastus     Standard_A1        1         Succeeded
Group002                                       VMSS004      eastus Standard_DS1_v2        2         Succeeded

Obtenha todos os Vmss na assinatura.

Exemplo 4: Obter todos os Vmss usando filtragem

Get-AzVmss -Name VMSS00*

ResourceGroupName                               Name       Location             Sku Capacity ProvisioningState
-----------------                               ----       --------             --- -------- -----------------
Group001                                       VMSS001      eastus Standard_DS1_v2        2         Succeeded
Group001                                       VMSS002      eastus     Standard_A1        2         Succeeded
Group002                                       VMSS003      eastus     Standard_A1        1         Succeeded
Group002                                       VMSS004      eastus Standard_DS1_v2        2         Succeeded

Obtenha todos os Vmss na assinatura que começam com "VMSS00".

Exemplo 5: Obter o Vmss com um valor UserData

Get-AzVmss -ResourceGroupName <RESOURCE GROUP NAME> -VMScaleSetName <VMSS NAME> -InstanceView:$false -UserData;

ResourceGroupName                           : <RESOURCE GROUP NAME>
Sku                                         :
  Name                                      : Standard_DS1_v2
  Tier                                      : Standard
  Capacity                                  : 2
UpgradePolicy                               :
  Mode                                      : Manual
ProvisioningState                           : Succeeded
Overprovision                               : True
DoNotRunExtensionsOnOverprovisionedVMs      : False
UniqueId                                    : <UNIQUE ID>
SinglePlacementGroup                        : False
Id                                          : /subscriptions/<SUBSCRIPTION ID>/resourceGroups/<RESOURCE GROUP NAME>/providers/Microsoft.Compute/virtualMachineScaleSets/<VMSS NAME>
Name                                        : usdvmss
Type                                        : Microsoft.Compute/virtualMachineScaleSets
Location                                    : eastus
Tags                                        :
{"azsecpack":"nonprod","platformsettings.host_environment.service.platform_optedin_for_rootcerts":"true"}
VirtualMachineProfile                       :
  OsProfile                                 :
    ComputerNamePrefix                      : <PREFIX>
    AdminUsername                           : <USERNAME>
    WindowsConfiguration                    :
      ProvisionVMAgent                      : True
      EnableAutomaticUpdates                : True
  StorageProfile                            :
    ImageReference                          :
      Publisher                             : MicrosoftWindowsServer
      Offer                                 : WindowsServer
      Sku                                   : 2016-Datacenter
      Version                               : latest
    OsDisk                                  :
      Caching                               : None
      CreateOption                          : FromImage
      DiskSizeGB                            : 127
      OsType                                : Windows
      ManagedDisk                           :
        StorageAccountType                  : Premium_LRS
  NetworkProfile                            :
    NetworkInterfaceConfigurations[0]       :
      Name                                  : <VMSS NAME>
      Primary                               : True
      EnableAcceleratedNetworking           : False
      DnsSettings                           :
      IpConfigurations[0]                   :
        Name                                : <VMSS NAME>
        Subnet                              :
          Id                                : /subscriptions/<SUBSCRIPTION ID>/resourceGroups/<RESOURCE GROUP NAME>/providers/Microsoft.Network/virtualNetworks/<VMSS NAME>/subnets/<VMSS NAME>
        PrivateIPAddressVersion             : IPv4
        LoadBalancerBackendAddressPools[0]  :
          Id                                : /subscriptions/<SUBSCRIPTION ID>/resourceGroups/<RESOURCE GROUP NAME>/providers/Microsoft.Network/loadBalancers/<VMSS NAME>/backendAddressPools/<VMSS NAME>
        LoadBalancerInboundNatPools[0]      :
          Id                                : /subscriptions/<SUBSCRIPTION ID>/resourceGroups/<RESOURCE GROUP NAME>/providers/Microsoft.Network/loadBalancers/<VMSS NAME>/inboundNatPools/<VMSS NAME>
        LoadBalancerInboundNatPools[1]      :
          Id                                : /subscriptions/<SUBSCRIPTION ID>/resourceGroups/<RESOURCE GROUP NAME>/providers/Microsoft.Network/loadBalancers/<VMSS NAME>/inboundNatPools/<VMSS NAME>
      EnableIPForwarding                    : False
  ExtensionProfile                          :
    Extensions[0]                           :
      Name                                  : Microsoft.Azure.Security.AntimalwareSignature.AntimalwareConfiguration
      Publisher                             : Microsoft.Azure.Security.AntimalwareSignature
      Type                                  : AntimalwareConfiguration
      TypeHandlerVersion                    : 2.0
      AutoUpgradeMinorVersion               : True
      EnableAutomaticUpgrade                : True
      Settings                              : {}
    Extensions[1]                           :
      Name                                  : Microsoft.Azure.Geneva.GenevaMonitoring
      Publisher                             : Microsoft.Azure.Geneva
      Type                                  : GenevaMonitoring
      TypeHandlerVersion                    : 2.0
      AutoUpgradeMinorVersion               : True
      EnableAutomaticUpgrade                : True
      Settings                              : {}
  UserData                                  : dQBwAGQAYQB0AGUAIAB2AG0AcwBzAA==

O valor UserData deve ser codificado em Base64. Este comando pressupõe que você criou um Vmss com um valor UserData.

Exemplo 6: Obter um conjunto de escala de máquina virtual por meio de seu ResourceId.

$rgname = "ResourceGroupName";
$loc = "eastus";
New-AzResourceGroup -Name $rgname -Location $loc;

$vmssSize = 'Standard_D4s_v3';
$vmssName1 = 'vmss1' + $rgname;
$imageName = "Win2019Datacenter";
$adminUsername = <Username>;
$adminPassword = <Password> | ConvertTo-SecureString -AsPlainText -Force;
$cred = New-Object System.Management.Automation.PSCredential($adminUsername, $adminPassword);

$result = New-AzVmss -ResourceGroupName $rgname -Credential $cred -VMScaleSetName $vmssName1 -ImageName $imageName;

$vmss = Get-AzVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName1;
$vmssId = $vmss.Id;
$vmssGet = Get-AzVmss -ResourceId $vmssId;

Faça um Vmss e obtenha esse mesmo Vmss por meio de seu ID de recurso ARM.

Parâmetros

-DefaultProfile

As credenciais, a conta, o locatário e a assinatura usados para comunicação com o azure.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InstanceView

Indica que esse cmdlet obtém apenas a exibição de instância do conjunto de escala da máquina virtual.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-OSUpgradeHistory

Indica que esse cmdlet lista o histórico de atualização do sistema operacional do conjunto de dimensionamento da máquina virtual.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ResourceGroupName

Especifica o nome do Grupo de Recursos do VMSS.

Type:String
Position:0
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:True

-ResourceId

O ID de recurso ARM especificando o objeto específico do conjunto de escala da máquina virtual que você deseja retornar.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-UserData

UserData para o Vmss, que será codificado em base-64. O cliente não deve passar nenhum segredo aqui.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-VMScaleSetName

Espécie o nome do VMSS.

Type:String
Aliases:Name
Position:1
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:True

Entradas

String

Saídas

PSVirtualMachineScaleSet