获取Azure VM的存储帐户 [英] Get storage account of Azure VM

查看:98
本文介绍了获取Azure VM的存储帐户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试找到PowerShell cmdlet,该cmdlet可以检索有关Azure VM使用哪个存储帐户的信息. 例如,我想提供VM的名称,并想查看该VM使用哪个存储.或者,查询特定的存储帐户并查看哪些VM使用该存储帐户也将是一件好事.

I am trying to find PowerShell cmdlet which can retrieve information about which storage account Azure VM use. Example, I want to supply name of VM and I would like to see which storage that VM use. Or it will be also good to query specific storage account and see which VMs use this storage account.

我正在尝试使用cmdlet,但看不到有关存储帐户的详细信息:

I am trying following cmdlets but I cannot see details about storage account:

Select-AzureSubscription -SubscriptionName "name"
Get-AzureVM -Name "name" -ServiceName "name"

推荐答案

Get-AzureDisk cmdlet可能对您有用.这就是我正在使用的方法.

The Get-AzureDisk cmdlet may be useful for you. This is the approach that I'm using.

$disk = Get-AzureDisk | Where-Object { $_.AttachedTo.RoleName -eq "YOURVMNAME" }
$mediaLink = $disk.MediaLink
$storageAccountName = $mediaLink.Host.Split('.')[0]

https://msdn.microsoft.com/en-us/library/azure/dn495125.aspx

这篇关于获取Azure VM的存储帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆