Get-AzHost
Mendapatkan atau mencantumkan host.
Sintaks
Get-AzHost
[-ResourceGroupName] <String>
[-HostGroupName] <String>
[[-Name] <String>]
[-InstanceView]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzHost
[-ResourceId] <String>
[-InstanceView]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Deskripsi
Cmdlet ini akan mendapatkan host dalam grup host. Cmdlet ini juga mencantumkan semua host dalam grup host jika nama host tidak diberikan.
Contoh
Contoh 1
Get-AzHost -ResourceGroupName $resourceGroupName -HostGroupName $hostGroupName -Name $hostName
ResourceGroupName : myrg01
PlatformFaultDomain : 1
AutoReplaceOnFailure : True
HostId : 00000000-0000-0000-0000-000000000000
VirtualMachines[0] :
Id : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myrg01/providers/Microsoft.Compute/virtualMachines/myvm01
VirtualMachines[1] :
Id : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myrg01/providers/Microsoft.Compute/virtualMachines/myvm02
ProvisioningTime : 7/27/2019 3:22:59 AM
ProvisioningState : Succeeded
Sku :
Name : ESv3-Type1
Id : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myrg01/providers/Microsoft.Compute/hostGroups/myhostgroup01/hosts/myhost01
Name : myhost01
Location : eastus
Tags : {"key1":"val2"}
Perintah ini mengembalikan host.
Contoh 2
Get-AzHost -ResourceGroupName $resourceGroupName -HostGroupName $hostGroupName -Name $hostName -InstanceView
ResourceGroupName : myrg01
PlatformFaultDomain : 0
AutoReplaceOnFailure : True
HostId : 00000000-0000-0000-0000-000000000000
ProvisioningTime : 8/19/2019 9:13:19 PM
ProvisioningState : Succeeded
InstanceView :
AssetId : 00000000-0000-0000-0000-000000000000
AvailableCapacity :
AllocatableVMs[0] :
VmSize : Standard_E2s_v3
Count : 28
AllocatableVMs[1] :
VmSize : Standard_E4-2s_v3
Count : 14
AllocatableVMs[2] :
VmSize : Standard_E4s_v3
Count : 14
Statuses[0] :
Code : ProvisioningState/succeeded
Level : Info
DisplayStatus : Provisioning succeeded
Time : 8/19/2019 9:13:19 PM
Statuses[1] :
Code : HealthState/available
Level : Info
DisplayStatus : Host available
Sku :
Name : ESv3-Type1
Id : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myrg01/providers/Microsoft.Compute/hostGroups/myhostgroup01/hosts/myhost01
Name : crptestps2264host
Location : eastus
Tags : {"key1":"val2"}
Perintah ini mengembalikan tampilan instans host.
Contoh 3
Get-AzHost -ResourceGroupName $resourceGroupName -HostGroupName $hostGroupName
ResourceGroupName Name Location Tags Sku FD
----------------- ---- -------- ---- --- --
myrg01 myhost01 eastus {[key1, val2]} ESv3-Type1 0
myrg01 myhost02 eastus {[key1, val2]} ESv3-Type1 1
Perintah ini mengembalikan semua host dalam grup host yang diberikan.
Contoh 4: Perintah ini menyetel ulang Host untuk -ResourceId yang disediakan.
$rgname = "rgname"
$loc = "eastus"
$hostGroupName = $rgname + "HostGroup"
$hostName = $rgname + "Host"
$Sku = "ESv3-Type1"
# Create Hostgroup and Hostgroupname
New-AzHostGroup -ResourceGroupName $rgname -Name $hostGroupName -Location $loc -PlatformFaultDomain 1 -Zone "2"
New-AzHost -ResourceGroupName $rgname -HostGroupName $hostGroupName -Name $hostName -Location $loc -Sku $Sku
# Fetch Host using -ResouceId
$dedicatedHost = Get-AzHost -ResourceGroupName $rgname -HostGroupName $hostGroupName -Name $hostName
$host = Get-AzHost -ResourceId $dedicatedHost.Id
ResourceGroupName : rgname
PlatformFaultDomain : 0
AutoReplaceOnFailure : True
HostId : 0730655b-051d-4559-a83a-5d579d15fec2
ProvisioningTime : 10/14/2022 7:28:47 AM
ProvisioningState : Succeeded
Sku :
Name : ESv3-Type1
Id : /subscriptions/e37510d7-33b6-4676-886f-ee75bcc01871/resourceGroups/rgname/providers/Microsoft.Compute/hostGroups/rgnameHostGroup/hosts/rgnameHost
Name : rgnameHost
Type : Microsoft.Compute/hostGroups/hosts
Location : eastus
Tags : {}
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 |
-HostGroupName
Nama grup host.
Jenis: | String |
Position: | 1 |
Nilai default: | None |
Diperlukan: | True |
Terima input alur: | True |
Terima karakter wildcard: | False |
-InstanceView
Menunjukkan bahwa cmdlet ini hanya mendapatkan tampilan instans host.
Jenis: | SwitchParameter |
Position: | Named |
Nilai default: | None |
Diperlukan: | False |
Terima input alur: | False |
Terima karakter wildcard: | False |
-Name
Nama host.
Jenis: | String |
Alias: | HostName |
Position: | 2 |
Nilai default: | None |
Diperlukan: | False |
Terima input alur: | True |
Terima karakter wildcard: | False |
-ResourceGroupName
Nama grup sumber daya
Jenis: | String |
Position: | 0 |
Nilai default: | None |
Diperlukan: | True |
Terima input alur: | True |
Terima karakter wildcard: | False |
-ResourceId
ID sumber daya.
Jenis: | String |
Position: | 0 |
Nilai default: | None |
Diperlukan: | True |
Terima input alur: | True |
Terima karakter wildcard: | False |