Hello,
You can use Azure PowerShell commands to get license information for a virtual machine. For example, use the Get-AzVM command to get the details of the virtual machine, and then check the LicenseType property.
Recommended reference links: How to Check the License Type of a Specific Azure VM using PowerShell Command? - GeeksforGeeks
Please note that the Windows Server license expiration date may not be displayed directly as it depends on the type of license you have. If you have a subscription-based license, the license is valid as long as your subscription is active. If you have a perpetual license, it does not expire.
Best Regards,
Yanhong Liu
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.