Skip to main content

Azure VM upgrade to Windows Server 2019

On Azure, if we've windows VM and want to upgrade it to latest version e.g. Windows server 2019, there is no direct way or available template on Azure to do it smoothly. Though there is a couple of alternative to achieve this like, 

  • Download the OS drive (c:) VHD on one of your systems, do the in-place upgrade (keeping all the files intact) and post local in-place upgrade upload the upgraded OS drive (c drive) VHD to the Azure storage account and replace the C drive of your VM. 
  • Create the new VM all-together with the new OS version, install your required software, setup file share user permission & do all the required settings, do the thorough testing and switch the old server domain name to new one & discard the old server. 
All these processes are the time-consuming activity which requires more effort from operations as well as from a testing point of view. 

What if we upgrade on Azure windows VM it-self (in-place upgrade) with more confidence. Yes we can and it can be done in 4-6 hours. Keep in mind before upgrading take the backup of VHDs (OS & data disks), make not of extensions, NIC. Here is the step by step process to achieve this: 

1.       Enable boot diagnostic:
2.       Take Screenshot of Disks from Portal:
                            The idea is to get the LUN number and disk names detail.
3.       Take Screenshot of Disks from Server: (Idea is to get the LUN number and disk drive letter mapped to it,
  • Step 2 & 3 will help us when we are going to create a new VM from disk snapshot, if requires
4.       Disable the disk encryption.
 
$vmName = "<<your-vm-name"
$rgName = "<<your-resource-group-name>>" 
 
Disable-AzureRmVMDiskEncryption -ResourceGroupName $rgName -VMName $vmName -VolumeType All
5.       Remove the disk encryption
·         Wait for few minutes until all disks are fully decrypted. Wait time all depends-on disk size. Depending on your disk size it may vary. For TBs of data disk, it will take a few hours to fully decrypt the disks.
Steps to verify:
·         Open PowerShell in admin mode
·         Command: Get-BitLockerVolume
·         If we see VolumeStatus (FullyDecrypted) or EncryptionPercentage (0)
We are good to proceed with next step with removing the disk encryption
NOTE: Before executing the below command make sure all OS & Data disks are fully decrypted.
 
Remove-AzureRmVMDiskEncryptionExtension -ResourceGroupName $rgName -VMName $vmName
 
6.       Take the snapshot or full backup of C drive and Other data drives (Other drives are for UAT & PROD)
·         keep the name of snapshot as <ORIGINAL-Name>_snapshot
7.       Login to server
8.       Un-install System Center Endpoint Protection (SCEP)
9.       Get the Windows server 2019 bit (Windows Server 2019 Standard and Datacenter)
10.   Start the in-place upgrade.
When getting the option “select image” choose the “Desktop experience”
§  Windows Server 2019 Standard
§  Windows Server 2019 Standard(Desktop Experience)
§  Windows Server 2019 DataCenter
§  Windows Server 2019 DataCeneter(Desktop Experience) 
Select the Windows server 2019 DataCenter (Desktop Experience)
·         In the screen “Choose what to keep” select “Keep personal files and apps”
11.   You may get warning/alert to remove some of the protection software’s like (SCEP)
  • Take note and un-install them one by one.
  • And again restart the in-place upgrade
12.   Start the server upgrade activity, it will take 2-2.5 hours to upgrade
We can keep track of the upgrade activity from Boot diagnostics from Azure portal
13.   Restart the server couple of time after in-lace upgrade.
14.   Do the sanity testing and share the result with team.
15.   Do the disk encryption. [may be we can take this activity after a day or two]
16.   Look into the protection software’s [from Step 8], in ideal case it should be installed in couple of days as it will be handled by Extension if not we have to install it manually or take your server admin help..
After all the above steps we’re good with upgrade.

Comments

Popular posts from this blog

How to install Zen-coding plugin

As a web-developer, irrespective of the technologies (java, c-sharp, python, php e.t.c.…), we used to write CSS code to make our web-pages looks good if not at least we’re involved in write html codes. What if there is some tool to whom you give some instruction and that tool generates a good, well formatted html tags for you. These kind of coding is possible and known as “ Zen coding ” and there are lots of plug-in available from different vendors. We’re going to  discuss the steps to install this “zen-coding” plugin for “visual studio, eclipse, sublime-text & notepad++ in next few lines. Follow the below steps to install "zen-coding" plugin based on your editor.  Steps to install zen-coding plugin for (visual studio, eclipse, sublime-text,notepad++) -- -- For Visual Studio 1. Go to "Tools" -> "Extensions and Updates" 2. It'll open the "Extensions and Updates windows"    Select online form Left hand menu items ent...

EFCore - Scaffold-DbContext how to use

EFCore versions, we don't have GUI to manage the DB-entities & dbContext like we used to have with EF6 (or EF5/4 version). With EFCore we've the Scaffold-DbContext command which helps us to create entities & DB context from our DB-objects.  Let's see how to use Scaffold-DbContext: Assume we're connecting with SQL Server so after creating a sample project you'll have to install EFCore related libraries as mentioned below.  Install entity-framework-core for SQL Server, at this time 3.1.9 is the latest stable version   Microsoft.EntityFrameworkcore   Microsoft.EntityFrameworkCore.SqlServer  To use Scaffold-DbContext, following two NuGet packages are required Microsoft.EntityFrameworkCore.Tools  Microsoft.EntityFrameworkCore.Design Let's say we've two DB tables (e.g. dbo.Employees & dbo.Users )  Now let's see how to use Scaffold-DbContext to create c-...

Azure SQL - Re-build index and update stats

Useful script to rebuild table indexes and update stats You can update the queries based on your requirement. To update the table stats --Query to update the table stats SELECT N'UPDATE STATISTICS ' + t.TABLE_SCHEMA + '.' + t.TABLE_NAME + ' ;' FROM INFORMATION_SCHEMA.tables AS t WHERE t.TABLE_TYPE = N'BASE table'; GO To re-build table indexes: --To rebuild table index DECLARE @myDatabaseName NVARCHAR(255) = N'your-database-name'; DECLARE @runningTableName NVARCHAR(255); DECLARE @cmd NVARCHAR(1000); DECLARE @name NVARCHAR(100)= 'your-database-name'; -- Populate the database cursor. DECLARE myDatabaseLevelCursor CURSOR READ_ONLY FOR SELECT @name; OPEN myDatabaseLevelCursor; FETCH NEXT FROM myDatabaseLevelCursor INTO @myDatabaseName; WHILE @@FETCH_STATUS = 0 BEGIN -- In this command we're declaring table level cursor SET @cmd = 'DECLARE myTableCursor CURSOR READ_ONLY FOR SELECT '...