Bagikan melalui


Get-AzVmss

Mendapatkan properti VMSS.

Sintaks

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>]

Deskripsi

Cmdlet Get-AzVmss mendapatkan tampilan model dan instans Dari Virtual Machine Scale Set (VMSS). Tampilan model adalah properti yang ditentukan pengguna dari set skala komputer virtual. Tampilan instans adalah status tingkat instans dari set skala komputer virtual. Tentukan parameter InstanceView untuk mendapatkan hanya tampilan instans dari set skala komputer virtual.

Contoh

Contoh 1: Mendapatkan properti 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                                        : {}

Perintah ini mendapatkan properti VMSS bernama VMSS001 yang termasuk dalam grup sumber daya bernama Group001. Karena perintah tidak menentukan parameter sakelar InstanceView , cmdlet mendapatkan tampilan model dari set skala komputer virtual.

Contoh 2: Mendapatkan semua Vm dalam grup sumber daya

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

Dapatkan semua Vm dalam grup sumber daya "Group001"

Contoh 3: Mendapatkan semua Vm dalam langganan

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

Dapatkan semua Vm dalam langganan.

Contoh 4: Mendapatkan semua Vm menggunakan pemfilteran

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

Dapatkan semua Vm dalam langganan yang dimulai dengan "VMSS00".

Contoh 5: Dapatkan Vm dengan nilai 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==

Nilai UserData harus dikodekan Base64. Perintah ini mengasumsikan Anda telah membuat Vm dengan nilai UserData.

Contoh 6: Dapatkan Set Skala Komputer Virtual melalui ResourceId-nya.

$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;

Buat Vmss kemudian dapatkan Vm yang sama melalui ID sumber daya ARM-nya.

Parameter

-DefaultProfile

Kredensial, akun, penyewa, dan langganan yang digunakan untuk komunikasi dengan azure.

Jenis:IAzureContextContainer
Alias:AzContext, AzureRmContext, AzureCredential
Position:Named
Nilai default:None
Diperlukan:False
Terima input alur:False
Terima karakter wildcard:False

-InstanceView

Menunjukkan bahwa cmdlet ini hanya mendapatkan tampilan instans dari set skala komputer virtual.

Jenis:SwitchParameter
Position:Named
Nilai default:None
Diperlukan:True
Terima input alur:False
Terima karakter wildcard:False

-OSUpgradeHistory

Menunjukkan bahwa cmdlet ini mencantumkan riwayat peningkatan os dari set skala komputer virtual.

Jenis:SwitchParameter
Position:Named
Nilai default:None
Diperlukan:True
Terima input alur:False
Terima karakter wildcard:False

-ResourceGroupName

Menentukan nama Grup Sumber Daya VMSS.

Jenis:String
Position:0
Nilai default:None
Diperlukan:False
Terima input alur:True
Terima karakter wildcard:True

-ResourceId

Id sumber daya ARM yang menentukan objek set skala komputer virtual tertentu yang ingin Anda kembalikan.

Jenis:String
Position:Named
Nilai default:None
Diperlukan:False
Terima input alur:True
Terima karakter wildcard:False

-UserData

UserData untuk Vmss, yang akan dikodekan base-64. Pelanggan tidak boleh meneruskan rahasia apa pun di sini.

Jenis:SwitchParameter
Position:Named
Nilai default:None
Diperlukan:False
Terima input alur:True
Terima karakter wildcard:False

-VMScaleSetName

Spesies nama VMSS.

Jenis:String
Alias:Name
Position:1
Nilai default:None
Diperlukan:False
Terima input alur:True
Terima karakter wildcard:True

Input

String

Output

PSVirtualMachineScaleSet