Apply Database ARM Template to existing Oracle WebLogic Server

This page documents how to configure an existing deployment of Oracle WebLogic Server with an existing Azure database using Azure CLI.

You can invoke the database ARM template to:

Prerequisites

Environment for Setup

Azure Managed Identity

You are required to input the ID of a user-assigned managed identity that has the Contributor at the subscription level of the current subscription.

To create a user-assigned managed identity, follow the steps in Manage user-assigned managed identities.

You will need the resource ID of the identity. To obtain ID of the identity: go to Azure Portal; open the identity Overview page; select JSON View and copy the Resource ID.

WebLogic Server Instance

The database ARM template will be applied to an existing Oracle WebLogic Server instance. If you don’t have one, please create a new instance from the Azure portal, by following the link to the offer in the index.

If you are using your own data source driver, make sure the data source driver is uploaded during the WebLogic Server instance provisioning.

You can create an Oracle WebLogic Server cluster with data source driver library with steps:

You will get an Oracle WebLogic Server cluster with your data source driver built in the image.

Database Instance

To apply a database with Oracle WebLogic Server, you must have an existing database instance to use.

Work with built-in data source driver

The marketplace offer ships with database driver for Oracle, Azure SQL Server, Azure Database for PostgreSQL and MySQL. You can invoke the dbTemplate to create data source connection for those database. If you do not have an instance, please create one from Azure portal. You are able to provision a MySQL instance quickly using Azure Database for MySQL.

Bring your own data source driver

Besides Oracle, Azure SQL Server, Azure Database for PostgreSQL and MySQL, you are able to create data source connection using other databases, such as IBM Informix and MariaDB, but you have to follow those steps to achieve that:

Apply multiple data source

You may want to enable multiple data source in your cluster for the following usage:

You can deploy different data source connections using the database ARM template, by changing the ARM parameters file and invoking the template again with Azure CLI.

To deploy data source using your own data source driver, we assume the data source driver has been uploaded to the cluster. See WebLogic Server Instance

Prepare the Parameters JSON file

Advanced parameter Name Explanation
_artifactsLocation Required. See below for details.
aksClusterName Required. String value.
Name of the AKS cluster. Must be the same value provided at deployment time.
dbPassword Required. String value.
Password for the data source connection.
dbUser Required. String value.
User id for the data source connection.
dsConnectionURL Required. String value.
JDBC connection string.
identity Required. Object value.
Azure user managed identity used, make sure the identity has permission to create/update/delete Azure resources. It’s recommended to assign “Contributor” role.
jdbcDataSourceName Required. String value.
JDBC name for the data source connection.
wlsDomainUID Required. String value.
UID of the domain that you are going to update. Make sure it’s the same with the initial cluster deployment.
wlsPassword Required. String value.
Password for WebLogic Administrator. Make sure it’s the same with the initial cluster deployment.
wlsUserName Required. String value.
User name for WebLogic Administrator. Make sure it’s the same with the initial cluster deployment.
databaseType Optinal. Enum value.
Defaults by oracle.
oracle: will provision a Oracle datasoruce connection.
postgresql: will provision a Azure Database for PostgreSQL data source connection.
sqlserver: will provision a Azure SQL Server data source connection.
mysql: will provision a MySQL data source connection.
dbConfigurationType Optinal. Enum value.
Defaults by createOrUpdate.
createOrUpdate: the deployment will create a new data source connection if there is no data source has the same name with jdbcDataSourceName, otherwise, will update the expected data source with new inputs.
delete: the deployment will delete a data source connection that has name jdbcDataSourceName
dbGlobalTranPro Optinal. Enum value.
Defaults by OnePhaseCommit. The transaction protocol (global transaction processing behavior) for the data source. You may use one from: ["TwoPhaseCommit", "LoggingLastResource", "OnePhaseCommit", "None"]

_artifactsLocation

This value must be the following.

https://raw.githubusercontent.com/oracle/weblogic-azure/2024-02-29-1-Q1/weblogic-azure-aks/src/main/arm/

Obtain the JDBC Connection String, Database User, and Database Password

The parameter dsConnectionURL stands for JDBC connection string. The connection string is database specific.

Oracle Database:

The following is the format of the JDBC connection string for Oracle Database:

jdbc:oracle:thin:@HOSTNAME:1521/DATABASENAME

For example:

jdbc:oracle:thin:@benqoiz.southeastasia.cloudapp.azure.com:1521/pdb1

Azure Database for PostgreSQL:

Deploy an Azure Database PostgreSQL as described in Create an Azure Database for PostgreSQL server in the Azure portal.

  1. Access the Azure portal, and go to the service instance.

  2. Click Connection Strings under Settings.

  3. Locate the JDBC section and click the copy icon on the right to copy the JDBC connection string to the clipboard. The JDBC connection string will be similar to the following:

jdbc:postgresql://20191015cbfgterfdy.postgres.database.azure.com:5432/{your_database}?user=jroybtvp@20191015cbfgterfdy&password={your_password}&sslmode=require

When passing this value to the ARM template, remove the database user and password values from the connection string, and let them be the parameters dbUser and dbPassword. In the above JDBC connection string sample, the value for dsConnectionURL argument after removing the database user and password, will be:

jdbc:postgresql://20191015cbfgterfdy.postgres.database.azure.com:5432/{your_database}?sslmode=require

Finally, replace {your_database} with the name of your database, typically postgres.

Azure SQL Server

Deploy Azure SQL Server as described in Create a single database in Azure SQL Database using the Azure portal, PowerShell, and Azure CLI.

  1. Access the Azure portal and go to the service instance.

  2. Click Connection Strings under Settings.

  3. Locate the JDBC section and click the copy icon on the right to copy the JDBC connection string to the clipboard. The JDBC connection string will be similar to the following:

jdbc:sqlserver://rwo102804.database.windows.net:1433;database=rwo102804;user=jroybtvp@rwo102804;password={your_password_here};encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;

When passing this value to the ARM template, remove the database user and password values, let them be the parameters dbUser and dbPassword. In the above JDBC connection string sample, the value for dsConnectionURL argument after removing the database user and password, will be:

jdbc:sqlserver://rwo102804.database.windows.net:1433;database={your_database};encrypt=true;tr

Finally, replace {your_database} with the name of your database.

MySQL

Deploy Azure Database for MySQL as described in Create an Azure Database for MySQL server by using the Azure portal.

  1. Access the Azure portal and go to the service instance.

  2. Note that, for Azure Database for MySQL, you need to add @<servername> to the admin user name, similar to weblogic@contoso.

  3. Click Connection Strings under Settings.

  4. Locate the JDBC section and click the copy icon on the right to copy the JDBC connection script to the clipboard. The JDBC connection string will be the value of url, similar to the following:

jdbc:mysql://contoso.mysql.database.azure.com:3306/{your_database}?useSSL=true&requireSSL=false

Next, replace {your_database} with the name of your database.

You have to append arguments according to the WLS version you are using.

Example Parameters JSON

{
    "_artifactsLocation": {
        "value": "https://raw.githubusercontent.com/oracle/weblogic-azure/2024-02-29-1-Q1/weblogic-azure-aks/src/main/arm/"
    },
    "aksClusterName": {
      "value": "aks-sample"
    },
    "databaseType": {
      "value": "postgresql"
    },
    "dbConfigurationType": {
      "value": "createOrUpdate"
    },
    "dbPassword": {
        "value": "Secret123!"
    },
    "dbUser": {
        "value": "postgres@sampledb"
    },
    "dsConnectionURL": {
        "value": "jdbc:postgresql://sampledb.postgres.database.azure.com:5432/postgres?sslmode=require"
    },
    "identity": {
      "value": {
        "type": "UserAssigned",
        "userAssignedIdentities": {
          "/subscriptions/subscription-id/resourceGroups/samples/providers/Microsoft.ManagedIdentity/userAssignedIdentities/azure_wls_aks": {}
        }
      }
    },
    "jdbcDataSourceName": {
      "value": "jdbc/WebLogicDB"
    },
    "wlsDomainUID": {
      "value": "sample-domain1"
    },
    "wlsPassword": {
      "value": "Secret123!"
    },
    "wlsUserName": {
      "value": "weblogic"
    }
  }

Invoke the ARM template

Assume your parameters file is available in the current directory and is named parameters.json. This section shows the commands to configure your Oracle WebLogic Server deployment with the specified database. Replace yourResourceGroup with the Azure resource group in which the Oracle WebLogic Server is deployed.

Validate your parameters file

The az group deployment validate command is very useful to validate your parameters file is syntactically correct.

az deployment group validate --verbose \
  --resource-group `yourResourceGroup` \
  --parameters @parameters.json \
  --template-uri https://raw.githubusercontent.com/oracle/weblogic-azure/2024-02-29-1-Q1/weblogic-azure-aks/src/main/arm/dbTemplate.json

If the command returns with an exit status other than 0, inspect the output and resolve the problem before proceeding. You can check the exit status by executing the commad echo $? immediately after the az command.

Execute the template

After successfully validating the template invocation, change validate to create to invoke the template.

az deployment group create --verbose \
  --resource-group `yourResourceGroup` \
  --parameters @parameters.json \
  --template-uri https://raw.githubusercontent.com/oracle/weblogic-azure/2024-02-29-1-Q1/weblogic-azure-aks/src/main/arm/dbTemplate.json

As with the validate command, if the command returns with an exit status other than 0, inspect the output and resolve the problem.

For a successful deployment, you should find "provisioningState": "Succeeded" in your output.

Verify Database Connection

Follow the steps to check if the database has successfully been connected.