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

EFCore - Collate function

Search in SQL server query is generally case insensitive (by default or based on database level collation). Suppose we have an employees table with a row having first-name column value as "My-First-Name", so if we want to do the case-sensitive search we have to explicitly use the related collate: In EF 5 (currently in Release Candidate version [RC.2.20475.6]) Collate function got introduced which helps us to use our specific collation based search.  C# with EF5 code sample: var employeeCaseSensitiveSearch = _dbContext.Employees .Where(x => EF.Functions.Collate(x.FirstName, "Latin1_General_CS_AS") == "my-first-name") .FirstOrDefault(); A related database query will be something like this: T-SQL: Case sensitive search (use specific collation e.g.: Latin1_General_CS_AS) SELECT * FROM dbo.Employees AS e WHERE e.FirstName Collate Latin1_General_CS_AS = 'my-first-name' Some of the useful CSharp function which g...

Git - Update submodule

Sometimes in the large project when we separate it in different repositories we need to take reference of one repository in another where some the sub-module concepts. Now if we move our submodule to a different repository or renaming its repo-path then we've to also update the repository where this sub-module is getting referenced. Let's see how to update the git submodule.  Step-1: First clone the repo Step-2: Open git UI to create a new local branch from master  Step-3: Open git bash -- Now run below command to (remove submodules & add them):  -- Remove submodule git submodule deinit YOUR_FIRST_REPO git rm YOUR_FIRST_REPO git commit -m "Removed submodule YOUR_FIRST_REPO" rm -rf .git/modules/YOUR_FIRST_REPO -- Add submodule git submodule add <<..YOUR_FIRST_REPO git URL>> Step-4: All good, let's push our changes to the master

EFCore - Update command is not updating the underlying data

Why my update command using EFCore is not updating the underlying data in the database though in middle-tier code it's successful, not throwing any error? Let's try to get the root cause and how to solve this.  When creating the model class of related database object if the primary key name is Id then no need to explicitly mention the Key in ef-core OnModelCreating.  But if we've key name different from Id then we have to explicitly mention it in our OnModelCreating. Something like this:  entity.HasKey(c => new {c.CustId }); Assume in the database we've Customers table like this: CREATE TABLE [dbo].[Customers]( [CustId] [INT] IDENTITY(1,1) NOT NULL Primary Key, [FirstName] [VARCHAR](50) NULL ) Point to ponder: In the database table, column CustId is already defined as Primary key.  In EFCore model setup, it's up to us to configure the Key as (custId) or configure it as HasNoKey() Assume we've set our entity with Ha...