[英]azure powershell can't find resource (vm) by name
我正在尝试通过powershell增加我的Azure Linux VM磁盘的大小,因为Azure门户仪表板无法对此VM执行此操作。 我无法在资源组中获取虚拟机,找不到它。
请注意,资源组和资源名称相同。 有没有一种获取资源的替代方法,我已经尝试过通过ID进行尝试,但是没有运气
Select-AzureRmSubscription –SubscriptionName 'BizSpark'
$rgName = 'abc'
$vmName = 'abc'
$vm = Get-AzureRmVM -ResourceGroupName $rgName -Name $vmName
错误正在得到
Get-AzureRmVM:找不到资源组“ abc”下的资源“ Microsoft.Compute / virtualMachines / abc”。
您是否尝试过不指定资源组,例如
#Login to your sub
login-azurermaccount
Select-AzureRmSubscription -SubscriptionName 'BizSpark'
$vms = Get-AzureRmVM
#list all the VMs returned by the above command
$vms
#first VM in the above collection
$vms[0]
#id of first vm
$vms[0].id
如果这不起作用,则值得检查您是否正在运行最新版本的cmdlet,因为我遇到了一些很棒的行为,这些行为已通过更新进行了修复。 https://docs.microsoft.com/en-us/powershell/azureps-cmdlets-docs/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.