使用 Azure powershell cmdlet 获取 AzVM 数据磁盘总大小

时间:2021-01-12 03:55:06

标签: azure powershell azure-powershell

我正在使用 Azure Powershell 脚本来提取一些数据。我想获取 VM 的总磁盘数据大小。有人可以帮忙吗?

$virtualM = Get-AzVM -ResourceGroupName $ResourceName
    foreach ($vmachine in $virtualM) {
        #Get VM Name and Total data disk size
        write-host 'VM NAME: '$vmachine.name 'Data disk total size: '$vmachine.StorageProfile.dataDisks.diskSizeGB
        
    }
<块引用>
#current output 
VM NAME: VM1 Datadisk total size: 1023
VM NAME: VM2 Datadisk total size: 1023 1023 1023

#what I am trying to get
VM NAME: VM1 Datadisk total size: 1023
VM NAME: VM2 Datadisk total size: 3069

1 个答案:

答案 0 :(得分:1)

像这样:

import { useEffect } from 'react'; 
import './App.css';

function App() {

  const bg = "./clouds.png";

  useEffect(() => {
    document.body.style.backgroundImage = `url('${bg}')`;

  }, [])

  return (
    <div className="App">

    </div>
  );
}

export default App;
<块引用>

VM NAME:1111 数据盘总大小:100
VM NAME:2222 数据盘总大小:2048
VM NAME:3333 数据盘总大小:7576
VM NAME:4444 数据盘总大小:7376
VM NAME:5555 数据盘总大小:7320

相关问题