It's possible that the issue is related to the configuration of your IIS server on the virtual machine. Here are a few things you can check:
- Make sure that the virtual machine has access to the internet and can connect to Azure Active Directory. You can try accessing the Azure AD sign-in page directly from the virtual machine's browser to confirm this.
- Check that the virtual directory for the sample application is configured correctly in IIS. Make sure that the application is configured to use the correct version of the .NET Framework, and that the virtual directory is mapped to the correct physical directory where the sample application is stored.
- Verify that the web.config file for the sample application is correctly configured with the necessary Azure AD settings. Double-check that the values for the client ID, tenant ID, and redirect URI are correct.
- Check the IIS logs for any errors or warnings related to the sample application. This could provide clues as to what might be causing the issue.
- Make sure that any firewalls or security settings on the virtual machine or on the network allow traffic to and from the Azure AD endpoints. You may need to work with your IT department to check and configure these settings.
I hope these suggestions help you troubleshoot the issue with the Azure AD authentication not working on your virtual machine.
Please, if this answer is helpful, click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please let me know.