无法在Azure中使用Powershell创建资源

时间:2016-10-21 21:40:52

标签: azure azure-powershell

有人可以告诉我为什么每次尝试在Azure中使用Powershell创建NIC时,我都会继续显示图像中显示的错误吗?

NIC

谢谢

1 个答案:

答案 0 :(得分:0)

您没有创建网络接口,而是尝试获取不存在的网络接口。要创建NIC,请使用以下过程:

# Get the Virtual Network 
$VNET = Get-AzureRmVirtualNetwork -Name ‘Demo-vnet’ -ResourceGroupName ‘Demo’

# Get the Subnet Id
$SubnetID = (Get-AzureRmVirtualNetworkSubnetConfig -Name ‘default’ -VirtualNetwork $VNET).Id

# Create the Network Interface
New-AzureRmNetworkInterface -Name "NICFW" -ResourceGroupName "AdatumRG" -Location "East Us" -SubnetId $SubnetID 

相应地更改变量并确保-Location参数与您的VNet位置匹配。