Deploy Java WebLogic apps to WebLogic on Azure Virtual Machines
This article shows you how to deploy a Java WebLogic web app with sign-in by Microsoft Entra account to WebLogic on Azure Virtual Machines.
Prerequisites
- Completion of one of the following articles for enabling security with Microsoft Entra ID:
- Enable sign-in for Java WebLogic apps using Microsoft Entra ID
- Enable sign-in for Java WebLogic apps using MSAL4J with Azure Active Directory B2C
- Enable Java WebLogic apps to sign in users and access Microsoft Graph
- Secure Java WebLogic apps using roles and role claims
- Secure Java WebLogic apps using groups and group claims
- A deployed Oracle WebLogic Server. For more information, see Deploy WebLogic Server on Azure Virtual Machine using the Azure portal.
Prepare the app for deployment
When you deploy your application to Oracle WebLogic Server, your redirect URL changes to the redirect URL of the app on the Oracle WebLogic Server instance. Use the following steps to change these settings in your properties file:
Navigate to your app's authentication.properties file and change the value of
app.homePage
to your deployed app's domain name, as shown in the following example. This domain name has the formhttp://<vm-host-name>:<port>/<your-app-path>
. You can get the host name and port from adminConsoleURL by removing/console/
. If you're using the recommended sample app, the URL should behttp://<vm-host-name>:<port>/testwebapp/
, which should be similar tohttp://wls-5b942e9f2a-admindomain.westus.cloudapp.azure.com:7001/testwebapp/
.# app.homePage is by default set to dev server address and app context path on the server # for apps deployed to azure, use https://your-sub-domain.azurewebsites.net app.homePage=http://<vm-host-name>:<port>/<your-app-path>
After saving this file, use the following command to rebuild your app:
mvn clean package
After rebuilding the app, follow the steps of Deploy a Java EE application from Administration Console portal to redeploy the application with your current .war file.
Update your Microsoft Entra ID app registration
Because the redirect URI changes to your deployed app on Oracle WebLogic Server, you also need to change the redirect URI in your Microsoft Entra ID app registration. Use the following steps to make this change:
Navigate to the Microsoft identity platform for developers App registrations page.
Use the search box to search for your app registration - for example,
java-servlet-webapp-authentication
.Open your app registration by selecting its name.
Select Authentication from the menu.
In the Web - Redirect URIs section, select Add URI.
Fill out the URI of your web app, appending
/auth/redirect
- for example,http://wls-5b942e9f2a-admindomain.westus.cloudapp.azure.com:7001/testwebapp/auth/redirect
.Select Save.
Your deployment is now complete.
More information
- Microsoft Authentication Library (MSAL) for Java
- Microsoft identity platform (Microsoft Entra ID for developers)
- Quickstart: Register an application with the Microsoft identity platform
- Understanding Microsoft Entra ID application consent experiences
- Understand user and admin consent
- MSAL code samples