Below is my code to popup and login through MSAL.
var app = PublicClientApplicationBuilder.Create(msal.ClientId)
.WithDefaultRedirectUri()
.WithTenantId(msal.TenantId)
.Build();
var result = await app.AcquireTokenInteractive(msal.Scopes).ExecuteAsync();
Code above works when it's running on my local machine.
And below is my settings in Azure AD. Its working when I set it to localhost:5000

But when I set the localhost to 'myWebAppUrl' which is hosted on Azure Virtual Machine. MSAL won't popup. And it will just return "The operation was cancelled". Anything I missed here?

Please check the below points.
In azure ad,the reply URL must begin with the scheme https, unless using localhost. ex
:http://localhost:5000Else you can use something likehttps://yourappurland don’t forget to Grant admin consent Under Permissions for the scopes you have in azure ad. Please check Redirect URI restrictionsApps that use system browsers:
http://localhostApps that use embedded browsers:
https://login.microsoftonline.com/common/oauth2/nativeclientFor Node.js, you can use
msal://redirectPlease check Add a redirect URI section and Client application configuration (MSAL) | Microsoft Docs And check if you can use confidential client to your app .
Other references