簡體   English   中英

如何在powershell的幫助下在excel表中獲取所有Azure VM的詳細信息以及與之關聯的所有標簽?

[英]How to get the details of the all Azure VM's with respective all Tag associated with it in excel sheet with the help of powershell?

是否有任何腳本或命令可以在 PowerShell 的幫助下在 Excel 表中獲取所有 azure VM 的報告,其中包括與該、RG 和訂閱相關的所有標簽?

您可以通過以下步驟實現 Powershell 腳本:

  1. 在本地計算機上安裝az模塊(Install-Module -Name 'Az' -allowclobber -scope currentuser)

  2. 使用此 cmd (connect-Azaccount) 連接到您的 Azure 訂閱。

  3. 使用Get-AzVm Get-AzVM (Az.Compute) | Microsoft Docs獲取訂閱下的 VM 列表並將輸出分配給一個變量,並使用 for each 循環來了解 Foreach - PowerShell | Microsoft Docs迭代變量中的列表並使用export-csv將輸出投影到 csv 文件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM