Set-azurermnetworkinterface:私有静态IP地址不属于子网前缀范围 [英] Set-azurermnetworkinterface : private static IP address does not belong to the range of subnet prefix

查看:163
本文介绍了Set-azurermnetworkinterface:私有静态IP地址不属于子网前缀范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在Azure中创建了一个虚拟机,我在其中安装了WordPress和MySQL。我也创建了一个Web应用程序。现在我需要将我的静态Web App IP地址分配给我创建的虚拟机。我尝试了以下命令,但没有运气。



I have recently created a virtual machine in Azure where I have installed WordPress and MySQL in it. I have created a Web App too. Now I need to assign my static Web App IP address to the Virtual machine I created. I tried the following commands but no luck there.

New-AzureReservedIP –ReservedIPName IP –Location "South Central US" -ServiceName ServName





我在虚拟机中使用最新的Azure Powershell。当我搜索解决方案时,人们说我使用的命令与最新的PowerShell不兼容。所以我使用下面解释的命令如下。





I am using latest Azure Powershell in my virtual machine. When I search for a solution people are saying the commands I used are not compatible with the latest powershell. So I used the commands explained here as follows.

$nic=Get-AzureRmNetworkInterface -Name networkinterfacename -ResourceGroupName resouorcegrpupname $nic.IpConfigurations[0].PrivateIpAllocationMethod = 'Static' $nic.IpConfigurations[0].PrivateIpAddress = 'ip address' Set-AzureRmNetworkInterface -NetworkInterface $nic





但是当我运行时,我收到错误,因为Set-AzureRmNetworkInterface:私有静态IP地址不属于子网前缀10.0.0.0/24的范围。



非常感谢任何帮助。在此先感谢。



注意:我已登录Powershell,我可以运行命令Add-AzureAccount,Select-AzureSubscription,Get-AzureStorageAccount。



我尝试过:





But when I run I am getting error as Set-AzureRmNetworkInterface : Private static IP address does not belong to the range of subnet prefix 10.0.0.0/24.

Any help is much appreciated. Thanks in advance.

Note : I have logged in to the Powershell and I am able to run the commands Add-AzureAccount, Select-AzureSubscription, Get-AzureStorageAccount.

What I have tried:

$nic=Get-AzureRmNetworkInterface -Name networkinterfacename -ResourceGroupName resouorcegrpupname $nic.IpConfigurations[0].PrivateIpAllocationMethod = 'Static' $nic.IpConfigurations[0].PrivateIpAddress = 'ip address' Set-AzureRmNetworkInterface -NetworkInterface $nic

推荐答案

nic =获取-AzureRmNetworkInterface -Name networkinterfacename -ResourceGroupName resouorcegrpu pname
nic=Get-AzureRmNetworkInterface -Name networkinterfacename -ResourceGroupName resouorcegrpupname


nic .IpConfigurations [ 0 ]。PrivateIpAllocationMethod = < span class =code-string>' 静态'
nic.IpConfigurations[0].PrivateIpAllocationMethod = 'Static'


nic .IpConfigurations [ 0 ]。PrivateIpAddress = ' ip address' Set-AzureRmNetworkInterface -NetworkInterface
nic.IpConfigurations[0].PrivateIpAddress = 'ip address' Set-AzureRmNetworkInterface -NetworkInterface


这篇关于Set-azurermnetworkinterface:私有静态IP地址不属于子网前缀范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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