Muokkaa

Jaa


Deploy Java WebSphere apps to Traditional WebSphere on Azure Virtual Machines

This article shows you how to deploy a Java WebSphere web app with sign-in by Microsoft Entra account to Traditional WebSphere on Azure Virtual Machines.

Prerequisites

Prepare the app for deployment

When you deploy your application to WebSphere Application Server, your redirect URL changes to the redirect URL of your deployed WebSphere Application Server instance. Use the following steps to change these settings in your properties file:

  1. Navigate to your app's authentication.properties file and change the value of app.homePage to your server URL and port number you're planning to use, as shown in the following example:

    # 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=https://<server-url>:<port-number>/msal4j-servlet-auth/
    
  2. After saving this file, use the following command to rebuild your app:

    mvn clean package
    
  3. After the code finishes building, copy the .war file over to your target server's file system.

Update your Microsoft Entra ID app registration

Because the redirect URI changes to your deployed app on WebSphere, you also need to change the redirect URI in your Microsoft Entra ID app registration. Use the following steps to make this change:

  1. Navigate to the Microsoft identity platform for developers App registrations page.

  2. Use the search box to search for your app registration - for example, java-servlet-webapp-authentication.

  3. Open your app registration by selecting its name.

  4. Select Authentication from the menu.

  5. In the Web - Redirect URIs section, select Add URI.

  6. Fill out the URI of your web app, appending /auth/redirect - for example, https://<server-url>:<port-number>/auth/redirect.

  7. Select Save.

Deploy the application

To deploy the application, use the following steps:

  1. On the Applications tab, select New Application, then New Enterprise Application.

  2. Choose the .war file you built, then select Next until you get to the Map context roots for Web modules installation step.

  3. For the context root, set it to the same value as after the port number in the 'Redirect URI' you set in sample configuration/Azure app registration. That is, if the redirect URI is http://<server-url>:9080/msal4j-servlet-auth/, then the context root should just be msal4j-servlet-auth.

  4. Select Finish.

  5. After the application finishes installing, go to the WebSphere enterprise applications section of the Applications tab.

  6. Select the .war file you installed from the list of applications and then select Start to deploy.

  7. After it finishes deploying, navigate to http://<server-url>:9080/{whatever you set as the context root} and you should be able to see the application.

Your deployment is now complete.

More information

Next steps

For other deployment options, see the following articles: