Hi
Azure does not currently support an upgrade of the operating system of a Microsoft Azure Virtual Machine, Instead, you should create a new Azure virtual machine that is running the supported version of the operating system that is required and then migrate the workload.
Reference: https://learn.microsoft.com/en-US/troubleshoot/azure/virtual-machines/server-software-support
There is a similar article using Azure Data science
https://learn.microsoft.com/en-us/azure/machine-learning/data-science-virtual-machine/ubuntu-upgrade
Best Regards