连接 cmdlet Powershell 或 Azure CLI

连接 cmdlet Powershell 或 Azure CLI

我在 powershell 或 Azure cli 中搜索命令,它显示了使用存储帐户的总大小、虚拟机中连接的磁盘数量以及 VM 中安装的 SQL 版本。

是否可以与 Get-AzureRmStorageAccount cmdlet | Get-AzureRmVM 连接以显示结果?

我将非常感激您的答复。

莱昂纳多·阿尔梅达

答案1

因为您可以连接几乎任何东西,我相信如果您真的愿意的话您可以这样做,但它将是完全不可读的。

您需要编写一个脚本来执行所需的操作。

为了帮助您入门,我提供了一些脚本/代码片段的链接:

获取存储帐户的可计费大小To get the billable size of a storage account
https://docs.microsoft.com/en-us/azure/storage/scripts/storage-blobs-container-calculate-billing-size-powershell

获取连接到虚拟机的数据磁盘数量
$datadisks = (Get-AzureRmVM -ResourceGroupName rg-name -Name vmName).DataDisks.count

机器上的 SQL 版本
https://stackoverflow.com/questions/7587077/how-do-i-check-for-the-sql-server-version-using-powershell

相关内容