我有一个命令,它给了我以下内容:
PS C:\Windows\system32> Get-AzureRmResource -ResourceGroupName XXX -ResourceType Microsoft.Network/expressRouteCircuits -isCollection -ApiVersion 2016-09-01 | select Properties Properties ---------- @{provisioningState=Succeeded; resourceGuid=XXX; peerings=System.Object[]; authorizations=System.Object[]; serviceProviderProperties=; circuitProvisio...
现在我只想从属性中捕获provisioningState=value
。
答案 0 :(得分:0)
this might help for fetching the provisioningState:
$resource = Get-AzureRmResource -ResourceGroupName XXX -ResourceType Microsoft.Network/expressRouteCircuits -isCollection -ApiVersion 2016-09-01 | select -expand Properties
$resource[provisioningState]
or
Get-AzureRmResource -ResourceGroupName XXX -ResourceType Microsoft.Network/expressRouteCircuits -isCollection -ApiVersion 2016-09-01 | select -expand Properties | %{$_.provisioningState}
AFAIK select does not work on hash table and properties is a hash table (infering from the output)