如何将Azure保留IP(经典)迁移到Azure公共IP(ARM)?

时间:2017-07-19 12:15:52

标签: azure azure-resource-manager

将Azure中的服务从经典模型迁移到Azure资源管理器(ARM)时,您的经典模型中可能会有一些保留的IP地址。保留IP的ARM对应物是公共IP。创建新的公共IP将导致另一个IP地址,并可能导致将您的IP地址列入白名单的客户端出现问题。

虽然最好使用基于FQDN的白名单。但是,它有时是不可能的,IP白名单是下一个最好的选择。如何在不获取新IP地址的情况下从保留的IP地址迁移到公共IP地址?

3 个答案:

答案 0 :(得分:4)

此主题的实际学分是针对此log entry中的Vatsana Kongtakane。我已经调整了这些项目,因为我认为大多数人已经拥有了保留的IP。我把它放在StackOverflow上的原因是为了防止信息丢失。

第1步 - 登录并准备ARM环境

# Login to your ARM account
Add-AzureRmAccount

# Get a list of available subscriptions
Get-AzureRMSubscription

# Select your subscription
Select-AzureRmSubscription -SubscriptionName <SubscriptionName>

# Register migration provider, this can take a couple minuites
Register-AzureRmResourceProvider -ProviderNamespace Microsoft.ClassicInfrastructureMigrate

# View the current RegistrationState status, do not proceed to step 2 until the status says Registered
Get-AzureRmResourceProvider -ProviderNamespace Microsoft.ClassicInfrastructureMigrate

第2步 - 登录您的经典帐户

# Login to your ASM account
Add-AzureAccount

# Get a list of available subscriptions
Get-AzureSubscription

# Select your subscription
Select-AzureSubscription –SubscriptionName <SubscriptionName>

第3步 - 迁移您保留的IP地址

# Show the list of all reserved IP addresses
Get-AzureReservedIP

# De-associate the reserved IP address from your cloud service
# (only necessary if the IP is still assigned to a service)
Remove-AzureReservedIPAssociation -ReservedIPName <ReservedIPName> -ServiceName <ServiceName>

# Check for issues during migration
Move-AzureReservedIP -ReservedIPName <ReservedIPName> -Validate

# Prepare the ReservedIP for migration
Move-AzureReservedIP -ReservedIPName <ReservedIPName> -Prepare

# Commit to migrating the ReservedIP (take a pretty long time)
Move-AzureReservedIP -ReservedIPName <ReservedIPName> -Commit

第4步 - 验证&amp;清理

此时如果您登录portal.azure.com,您应该在公共IP地址下看到具有正确IP地址的资源。它正在转移到新的资源组,但您可以将其移动到您喜欢的资源组。

答案 1 :(得分:0)

我无法使旧的ASM PowerShell命令在Azure门户的Cloud Shell中工作。这是使用Azure CLI将传统的预留IP迁移到公共IP的方法。

azure account set <subscriptionNameOrId>
azure provider register Microsoft.ClassicInfrastructureMigrate
azure provider show Microsoft.ClassicInfrastructureMigrate
azure config mode asm
azure network reserved-ip list
azure network reserved-ip disassociate <name> <service-name> <deployment-name>
azure network reserved-ip list
azure network reserved-ip validate-migration <name>
azure network reserved-ip prepare-migration <name>
azure network reserved-ip commit-migration <name>

答案 2 :(得分:0)

安装模块Azure

安装模块Azure -AllowClobber ##关闭Powershell并重新打开}

导入模块Azure

{保留经典IP}

https://docs.microsoft.com/en-us/previous-versions/azure/virtual-network/virtual-networks-reserved-public-ip#reserve-the-ip-address-of-an-existing-cloud-service

New-AzureReservedIP –ReservedIPName MyReservedIP –位置“ 美国中部” -ServiceName busa

### 服务名称= busa ## ==> DNS名称:- Bus .cloudapp.net