Hi SAGA,
I completely understand why you prefer an in-place upgrade-retaining the exact same IP, hostname, and baseline configurations saves a massive amount of provisioning time. However, while your plan to demote the 2016 server before upgrading makes the process technically supported, performing an in-place upgrade on an Azure VM comes with a significant operational penalty.
The Azure Control-Plane Catch: When you perform an in-place upgrade inside the guest OS, Azure's underlying fabric metadata does not update. Azure will permanently view this VM's source image as "Windows Server 2016." This mismatch permanently breaks critical Azure management integrations, including the Azure Update Manager, Hotpatching, and Auto OS image upgrades.
The Microsoft Recommended Path: For Domain Controllers, the definitive best practice is to entirely avoid in-place upgrades. You should deploy a brand-new Windows Server 2022 VM from the Azure Marketplace, join it, promote it, transfer your FSMO roles, and then demote the old 2016 server. If keeping the exact same IP address is a strict requirement for your environment, you can simply reassign the old static IP to the new 2022 VM immediately after the 2016 server is demoted and shut down.
How to upgrade if you must proceed: If your OS team accepts the loss of Azure control-plane features and insists on an in-place upgrade for the demoted server, you do not use a traditional ISO file in the cloud. Here is the exact method:
Attach Media: Create and attach an Azure Managed Disk that contains the extracted Windows Server 2022 installation media to your VM.
Execute Setup: RDP into the server, locate the drive letter of the attached disk, open an elevated PowerShell prompt, and run the following command: .\setup.exe /auto upgrade /dynamicupdate disable /eula accept
Monitor: The RDP session will drop during the upgrade, but you can monitor the installation progress via the Azure Boot Diagnostics screenshot feature in the portal.
I hope this gives you the clear insights needed to weigh the risks and make the best architectural decision for your Active Directory environment. If this helped clarify the Azure-specific upgrade mechanics, please click "Accept Answer".
Tracy.