Azure Powershell-如何获得资源状态



我有几种Microsoft.apimanagement/Service类型的资源。

当我使用该资源类型下面的查找CMDLET时,它不会返回资源的状态/状态。我可以在门户网站上看到状态,但是通过资源类型检索资源状态,以获取可以钻探的摘要仪表板的数据。-resourcetype" Microsoft.web/sites"按预期工作并显示资源的状态。

我不确定是否必须为" Microsoft.apimanagement/Service"做其他事情才能使其显示状态。-resourcetype" Microsoft.storage/storageaccounts"也没有显示该状态,尽管在门户网站,主:可用,次要:可用。似乎每种资源类型都有其定义的属性集,并且必须找到文档以行走该资源类型以找到一个人的需求。我不知道在哪里可以找到该信息。

谢谢!

Find-AzureRmResource -ResourceType "microsoft.web/sites"  -ExpandProperties |Sort SiteName
Find-AzureRmResource -ResourceType "Microsoft.ApiManagement/service"  -ExpandProperties |Sort Name
Find-AzureRmResource -ResourceType "Microsoft.Storage/storageAccounts"  -ExpandProperties |Sort Name

如果我的理解是正确的,则可以使用以下命令。

$api=Get-AzureRmResource -ResourceType "Microsoft.ApiManagement/service" -ResourceGroupName shuapi5 -ResourceName shuiapi
$api.Properties.provisioningState

i在我的实验室中测试,它对我有用。

PS C:Usersv-shshui> $api=Get-AzureRmResource -ResourceType "Microsoft.ApiManagement/service" -ResourceGroupName shuapi5 -ResourceName shuiapi
PS C:Usersv-shshui> $api.Properties.provisioningState
Activating

最新更新