Wednesday, June 29, 2016

Change the address space of a Azure virtual network containing a functional server farm

I have recently deployed a SharePoint farm in Microsoft Azure Infrastructure as a Service (IaaS). That server farm contains following servers.

  • Domain Controller with DNS
  • File Server
  • SQL Server
  • Analysis Services Server
  • SharePoint Server

Furthermore I’ve configured Point-to-Site VPN connectivity as well. Following is how the environment was structured.

image

Everything looks good until I received a request to move everything to a different network address space. It seems that there was an internal network range which conflicts with my 11.0.0.0/16 address space. The only option is to move to a new virtual address space.

Following was the desired configuration.

image

I had few challenges to overcome

  1. Move the environment to a new address space without corrupting my servers
  2. Consume the existing Domain Controller and DNS
  3. Continue to use my SharePoint server

Luckily I got recommendations from my good friend Janaka and received a great help from Denny Cherry to find a solution. This post is written to summarize the approach I took to move my environment to a new address space.

Okay. Let’s start the migration.

Following are the steps I followed.

1. Stop and deallocate all servers in the environment.

2. In Domain Controller remove the static IP assignment

image

3. Add a new Address Space in Virtual Network

image

4. Add new Subnets in that Address Space

image

5. I have to execute some PowerShell commands. I need to get the names of network cards in each server prior to that

image

6. First we need to connect to the environment

Login-AzureRMAccount
Get-AzureRmSubscription
Get-AzureRmSubscription –SubscriptionName "My Subscription" | Select-AzureRmSubscription –SubscriptionName "My Subscription"

7. Declare variables

$rgname = "TRS-Test-Res-01"
$vnetname = "TRS-Test-Net-01"
$subnetName1 = "TRS-Test-Sub-01"
$subnetName2 = "TRS-Test-Sub-02"

$adNICName = "trs-test-dc-01646"
$fsNICName = "trs-test-fs-01971"
$dbNICName = "trs-test-db-01899"
$asNICName = "trs-test-as-01350"
$spNICName = "trs-test-sp-01892"

8. Get Virtual Network and Subnets

$vnet = Get-AzureRmVirtualNetwork -ResourceGroupName $rgname -Name $vnetname
$subnet1 = Get-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork $vnet -Name $subnetName1
$subnet2 = Get-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork $vnet -Name $subnetName2

9. Migrate the first server (Domain Controller)

$nicAD = Get-AzureRmNetworkInterface -ResourceGroupName $rgname -Name $adNICName
$nicAD.IpConfigurations[0].Subnet = $subnet1
Set-AzureRmNetworkInterface -NetworkInterface $nicAD

I have to do some extra steps to update the DNS server (Activities from step 10 to step 13).

10.  Start the Domain Controller server

11. In Virtual Network set the custom DNS

image

But still it shows 11.0.0.4 as the DNS server, when I checked within the domain controller

image

12. Execute following commands and restart the domain controller

  • ipconfig /flushdns
  • ipconfig /registerdns
  • dcdiag /fix

image

image

image

13. Check ipconfig /all again after the restart

image

Now the DNS servers are updated properly

14. Now we have to migrate other servers

#File Server
$nicFS = Get-AzureRmNetworkInterface -ResourceGroupName $rgname -Name $fsNICName
$nicFS.IpConfigurations[0].Subnet = $subnet1
Set-AzureRmNetworkInterface -NetworkInterface $nicFS


#SSAS Server
$nicAS = Get-AzureRmNetworkInterface -ResourceGroupName $rgname -Name $asNICName
$nicAS.IpConfigurations[0].Subnet = $subnet1
Set-AzureRmNetworkInterface -NetworkInterface $nicAS


#DB Server
$nicDB = Get-AzureRmNetworkInterface -ResourceGroupName $rgname -Name $dbNICName
$nicDB.IpConfigurations[0].Subnet = $subnet2
Set-AzureRmNetworkInterface -NetworkInterface $nicDB


#SharePoint Server
$nicSP = Get-AzureRmNetworkInterface -ResourceGroupName $rgname -Name $spNICName
$nicSP.IpConfigurations[0].Subnet = $subnet2
Set-AzureRmNetworkInterface -NetworkInterface $nicSP

15. Once all servers are migrated we need to restart them

16. Now we can delete Subnets from my previous environment (TRS-Test-Sub-01 and TRS-Test-Sub-02)

image

image

17. Later we can delete the Address Space of my previous environment

image

That’s all I had to do. Hope this helps someone .

2 comments:

Petter Marry said...
This comment has been removed by the author.
Unknown said...

Really nice information, very easy to understand. Keep share with us more information. Get more knowledge on Azure Online Training