Azure Key Vault × OCI Vault 横断比較仕様書
~ IaaS / PaaS × Java / PowerShell 全パターン対応版 ~
📋 本資料の目的と対象範囲
本資料は、Azure Key Vault と OCI Vault を使用したシークレット管理について、
IaaS・PaaS の両環境、Java・PowerShell の両言語の計4パターンを横断的に比較・整理した仕様書です。
| 比較軸 | Azure | OCI |
|---|---|---|
| サービス名 | Azure Key Vault | OCI Vault |
| 対象DB | Azure SQL Database | Oracle Database |
| IaaS環境 | Azure Virtual Machines | OCI Compute VM |
| PaaS環境 | Azure App Service / Azure Functions | OCI Functions |
1. アーキテクチャ全体図
1-1. Azure 構成図
┌─────────────────────────────────────────────────────┐
│ Azure テナント │
│ │
│ ┌──────────────┐ RBAC ロール割り当て │
│ │ Azure │◄────────────────────────┐ │
│ │ Key Vault │ │ │
│ │ │ シークレット取得 │ │
│ │ [シークレット] │◄──────────────────┐ │ │
│ └──────────────┘ │ │ │
│ │ │ │
│ ┌─────────────────┐ ┌─────────────────────────┐ │
│ │ IaaS │ │ PaaS │ │
│ │ (Azure VM) │ │ (App Service / Functions)│ │
│ │ │ │ │ │
│ │ ┌─────────────┐ │ │ ┌─────────────────────┐ │ │
│ │ │マネージドID │ │ │ │ マネージドID │ │ │
│ │ │(システム割当)│ │ │ │ (システム割当) │ │ │
│ │ └─────────────┘ │ │ └─────────────────────┘ │ │
│ │ Java / PS │ │ Java / PS │ │
│ └────────┬────────┘ └───────────┬─────────────┘ │
│ │ │ │
│ └───────────┬───────────┘ │
│ ▼ │
│ ┌─────────────────┐ │
│ │ Azure SQL DB │ │
│ └─────────────────┘ │
└─────────────────────────────────────────────────────┘
1-2. OCI 構成図
┌─────────────────────────────────────────────────────┐
│ OCI テナント │
│ │
│ ┌──────────────┐ 動的グループ+ポリシー │
│ │ OCI Vault │◄────────────────────────┐ │
│ │ │ │ │
│ │ [シークレット]│ シークレット取得 │ │
│ │ (Base64形式) │◄──────────────────┐ │ │
│ └──────────────┘ │ │ │
│ │ │ │
│ ┌─────────────────┐ ┌─────────────────────────┐ │
│ │ IaaS │ │ PaaS │ │
│ │ (Compute VM) │ │ (OCI Functions) │ │
│ │ │ │ │ │
│ │ ┌─────────────┐ │ │ ┌─────────────────────┐ │ │
│ │ │インスタンス │ │ │ │ リソース │ │ │
│ │ │プリンシパル │ │ │ │ プリンシパル │ │ │
│ │ └─────────────┘ │ │ └─────────────────────┘ │ │
│ │ Java / PS │ │ Java / PS │ │
│ └────────┬────────┘ └───────────┬─────────────┘ │
│ │ │ │
│ └───────────┬───────────┘ │
│ ▼ │
│ ┌─────────────────┐ │
│ │ Oracle Database │ │
│ └─────────────────┘ │
└─────────────────────────────────────────────────────┘
2. サービス概念の対応表
| 概念 | Azure | OCI | 補足 |
|---|---|---|---|
| シークレット管理サービス | Azure Key Vault | OCI Vault | — |
| シークレットの保存単位 | シークレット (Secret) | シークレット (Secret) | — |
| シークレットの値の形式 | 平文 で返却 | Base64エンコード で返却 | OCI はデコード処理が必須 |
| IaaS の認証方式 | マネージドID(システム割り当て) | インスタンス・プリンシパル | 構成ファイル不要で自動認証 |
| PaaS の認証方式 | マネージドID(システム割り当て) | リソース・プリンシパル | IaaSと異なるプロバイダーを使用 |
| 権限管理方式 | RBAC ロール割り当て(1ステップ) | 動的グループ+ポリシー(2ステップ) | OCI は設定手順が多い |
| 最小権限ロール名 | Key Vault シークレット ユーザー |
read secret-bundle ポリシー |
— |
| PaaS 環境変数注入 | Key Vault 参照(コード不要) | Functions 設定変数(OCIDを渡す形式) | Azure の方が簡易 |
| プライベート通信経路 | プライベートエンドポイント | サービス・ゲートウェイ | — |
3. 認証・権限設定の比較
3-1. IaaS(VM)での認証設定手順
| 手順 | Azure | OCI |
|---|---|---|
| ① VM側の設定 | システム割り当てマネージドIDを「オン」 | (設定不要。VM作成時から利用可能) |
| ② 識別子の取得 | マネージドIDの principalId を取得 |
VMの instanceId (OCID) を取得 |
| ③ グループ設定 | (不要) | 動的グループを作成しVMのOCIDを登録 |
| ④ 権限付与 | Key Vault の IAM で RBAC ロールを割り当て |
ポリシーで動的グループに read secret-bundle を許可 |
Azure のコマンド例:
# マネージドIDを有効化
az vm identity assign \
--resource-group rg-handson \
--name vm-handson
# Key Vault シークレット ユーザーロールを付与(1コマンドで完結)
az role assignment create \
--assignee <principalId> \
--role "Key Vault Secrets User" \
--scope <KeyVaultのリソースID>
OCI のコマンド例:
# ① 動的グループの作成(Azure にはない手順)
oci iam dynamic-group create \
--name "vm-dynamic-group" \
--matching-rule "instance.id = '<VMのOCID>'"
# ② ポリシーの作成(Azure にはない手順)
oci iam policy create \
--name "vault-access-policy" \
--statements '["Allow dynamic-group vm-dynamic-group to read secret-bundle in compartment id <コンパートメントID>"]'
3-2. PaaS(App Service / Functions)での認証設定手順
| 手順 | Azure | OCI |
|---|---|---|
| ① PaaS側の設定 | システム割り当てマネージドIDを「オン」 | (Functions作成時から利用可能) |
| ② 識別子の取得 | マネージドIDの principalId を取得 |
FunctionアプリのOCIDを取得 |
| ③ グループ設定 | (不要) | 動的グループを作成しFunctionsを登録 |
| ④ 権限付与 | Key Vault の IAM で RBAC ロールを割り当て |
ポリシーで動的グループに read secret-bundle を許可 |
| ⑤ 環境変数設定 | Key Vault 参照を App Settings に設定(コード不要) | Functions設定変数にシークレットOCIDを設定 |
4. シークレット取得の実装比較
4-1. ⚠️ 最重要な差異:シークレット値のエンコード形式
Azure Key Vault → 平文で返却(デコード不要)
OCI Vault → Base64エンコードで返却(必ずデコードが必要)
OCI でのデコード処理(Java):
Base64SecretBundleContentDetails content =
(Base64SecretBundleContentDetails) response.getSecretBundle().getSecretBundleContent();
byte[] decoded = Base64.getDecoder().decode(content.getContent()); // デコード必須
String secret = new String(decoded, StandardCharsets.UTF_8);
OCI でのデコード処理(PowerShell):
$b64 = $bundle.SecretBundleContent.Content
$secret = [System.Text.Encoding]::UTF8.GetString(
[System.Convert]::FromBase64String($b64) # デコード必須
)
5. パターン別 実装仕様
パターン1:IaaS × Java
5-1-A. Azure(IaaS × Java)
使用ライブラリ(Maven):
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.11.1</version>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-security-keyvault-secrets</artifactId>
<version>4.7.2</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>12.4.2.jre11</version>
</dependency>
実装コード:
import com.azure.identity.DefaultAzureCredentialBuilder;
import com.azure.security.keyvault.secrets.SecretClient;
import com.azure.security.keyvault.secrets.SecretClientBuilder;
public class AzureIaaSJava {
public static void main(String[] args) throws Exception {
// ① DefaultAzureCredential でマネージドIDを自動検知
// VM上ではシステム割り当てマネージドIDが自動で使用される
SecretClient client = new SecretClientBuilder()
.vaultUrl("https://<KeyVault名>.vault.azure.net/")
.credential(new DefaultAzureCredentialBuilder().build())
.buildClient();
// ② シークレットを取得(平文で返却されるためデコード不要)
String connStr = client.getSecret("DbConnectionString").getValue();
// ③ Azure SQL Database に接続
try (var conn = java.sql.DriverManager.getConnection(connStr);
var stmt = conn.createStatement()) {
var rs = stmt.executeQuery("SELECT @@VERSION");
if (rs.next()) System.out.println("✅ 接続成功: " + rs.getString(1));
}
}
}
5-1-B. OCI(IaaS × Java)
使用ライブラリ(Maven):
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-secrets</artifactId>
<version>3.35.0</version>
</dependency>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-common-httpclient-jersey</artifactId>
<version>3.35.0</version>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc11</artifactId>
<version>23.4.0.24.05</version>
</dependency>
実装コード:
import com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider;
import com.oracle.bmc.secrets.SecretsClient;
import com.oracle.bmc.secrets.model.Base64SecretBundleContentDetails;
import com.oracle.bmc.secrets.requests.GetSecretBundleRequest;
import java.util.Base64;
public class OciIaaSJava {
public static void main(String[] args) throws Exception {
// ① インスタンス・プリンシパル認証(Azure の DefaultAzureCredential に相当)
// ※ Azure と異なり、IaaS 専用のプロバイダーを明示的に使用する
var provider = InstancePrincipalsAuthenticationDetailsProvider
.builder().build();
var client = SecretsClient.builder().build(provider);
// ② シークレットを取得(Base64エンコードで返却される)
var request = GetSecretBundleRequest.builder()
.secretId(System.getenv("SECRET_ID_CONN"))
.build();
var response = client.getSecretBundle(request);
var content = (Base64SecretBundleContentDetails)
response.getSecretBundle().getSecretBundleContent();
// ③ Base64デコード(Azure との最大の違い。必須処理)
String connStr = new String(
Base64.getDecoder().decode(content.getContent())
);
// ④ Oracle Database に接続
String dbPass = getDecodedSecret(client, System.getenv("SECRET_ID_PASS"));
try (var conn = java.sql.DriverManager.getConnection(connStr, "ADMIN", dbPass);
var stmt = conn.createStatement()) {
var rs = stmt.executeQuery("SELECT SYSDATE FROM DUAL");
if (rs.next()) System.out.println("✅ 接続成功: " + rs.getString(1));
}
}
private static String getDecodedSecret(SecretsClient client, String secretId) {
var req = GetSecretBundleRequest.builder().secretId(secretId).build();
var content = (Base64SecretBundleContentDetails)
client.getSecretBundle(req).getSecretBundle().getSecretBundleContent();
return new String(Base64.getDecoder().decode(content.getContent()));
}
}
パターン2:IaaS × PowerShell
5-2-A. Azure(IaaS × PowerShell)
# ① マネージドIDとしてAzureにログイン
Connect-AzAccount -Identity
Write-Host "✅ マネージドIDでのログイン成功" -ForegroundColor Green
# ② Key Vault からシークレットを取得(平文で返却されるためデコード不要)
$connStr = Get-AzKeyVaultSecret `
-VaultName "<KeyVault名>" `
-Name "DbConnectionString" `
-AsPlainText
Write-Host "✅ シークレット取得成功" -ForegroundColor Green
# ③ Azure SQL Database に接続
$conn = New-Object System.Data.SqlClient.SqlConnection($connStr)
$conn.Open()
$cmd = $conn.CreateCommand()
$cmd.CommandText = "SELECT @@VERSION"
$result = $cmd.ExecuteScalar()
Write-Host "✅ 接続成功: $result" -ForegroundColor Green
$conn.Close()
5-2-B. OCI(IaaS × PowerShell)
# ① インスタンス・プリンシパルで認証
# -AuthType InstancePrincipal を指定(Azure の -Identity に相当)
$bundle = Get-OCISecretsSecretBundle `
-SecretId $env:SECRET_ID_CONN `
-AuthType InstancePrincipal # ← IaaS 専用。PaaS では ResourcePrincipal に変更
# ② Base64デコード(Azure との最大の違い。必須処理)
$connStr = [System.Text.Encoding]::UTF8.GetString(
[System.Convert]::FromBase64String($bundle.SecretBundleContent.Content)
)
Write-Host "✅ シークレット取得・デコード成功" -ForegroundColor Green
# ③ パスワードも同様に取得・デコード
$bundlePass = Get-OCISecretsSecretBundle `
-SecretId $env:SECRET_ID_PASS `
-AuthType InstancePrincipal
$dbPass = [System.Text.Encoding]::UTF8.GetString(
[System.Convert]::FromBase64String($bundlePass.SecretBundleContent.Content)
)
# ④ Oracle Database に接続
$conn = New-Object Oracle.ManagedDataAccess.Client.OracleConnection(
"User Id=ADMIN;Password=$dbPass;Data Source=$connStr"
)
$conn.Open()
$cmd = $conn.CreateCommand()
$cmd.CommandText = "SELECT SYSDATE FROM DUAL"
$result = $cmd.ExecuteScalar()
Write-Host "✅ 接続成功: $result" -ForegroundColor Green
$conn.Close()
パターン3:PaaS × Java
5-3-A. Azure(PaaS × Java)
App Service での Key Vault 参照(推奨方法):
# Azure CLI で環境変数に Key Vault 参照を設定
# → コードを変更せず環境変数として値を注入できる(Azure の大きな利点)
az webapp config appsettings set \
--name <App Service名> \
--resource-group <リソースグループ> \
--settings \
DB_CONNECTION_STRING="@Microsoft.KeyVault(VaultName=<KeyVault名>;SecretName=DbConnectionString)"
// Key Vault 参照を使った場合:環境変数から取得するだけでよい
// SDK の呼び出しコードが一切不要
public class AzurePaaSJava {
public String handleRequest() {
// Azure が起動時に自動でシークレットを注入してくれる
String connStr = System.getenv("DB_CONNECTION_STRING");
// → 以降は通常の JDBC 処理
return "取得した接続文字列の先頭: " + connStr.substring(0, 20) + "...";
}
}
SDK を使って直接取得する場合(IaaS と同じコードが使える):
// PaaS(App Service)でも DefaultAzureCredential がそのまま使える
// IaaS と PaaS でコードの変更が不要(Azure の利点)
SecretClient client = new SecretClientBuilder()
.vaultUrl("https://<KeyVault名>.vault.azure.net/")
.credential(new DefaultAzureCredentialBuilder().build()) // IaaS と同じ
.buildClient();
String connStr = client.getSecret("DbConnectionString").getValue();
5-3-B. OCI(PaaS × Java)
import com.oracle.bmc.auth.ResourcePrincipalAuthenticationDetailsProvider;
// ↑ IaaS の InstancePrincipalsAuthenticationDetailsProvider から変更が必要
public class OciPaaSJava {
// Functions の初期化時にクライアントを生成(コールドスタート対策)
private static final SecretsClient client;
static {
// ① リソース・プリンシパル認証(PaaS専用。IaaSとの唯一の違い)
var provider = ResourcePrincipalAuthenticationDetailsProvider
.builder().build();
client = SecretsClient.builder().build(provider);
}
public String handleRequest(String input) throws Exception {
// ② 環境変数からシークレットOCIDを取得
String secretId = System.getenv("SECRET_ID_CONN");
// ③ シークレットを取得(Base64エンコード)
var request = GetSecretBundleRequest.builder()
.secretId(secretId).build();
var content = (Base64SecretBundleContentDetails)
client.getSecretBundle(request).getSecretBundle().getSecretBundleContent();
// ④ Base64デコード(PaaSでも必須。Azure との違い)
String connStr = new String(
Base64.getDecoder().decode(content.getContent())
);
// ⑤ Oracle Database に接続
try (var conn = DriverManager.getConnection(connStr, "ADMIN", getDbPass());
var stmt = conn.createStatement()) {
var rs = stmt.executeQuery("SELECT SYSDATE FROM DUAL");
if (rs.next()) return "✅ 接続成功: " + rs.getString(1);
}
return "処理完了";
}
}
パターン4:PaaS × PowerShell
5-4-A. Azure(PaaS × PowerShell)
Key Vault 参照を使った環境変数注入(推奨):
# Azure Functions (PowerShell) での実装
# アプリ設定に Key Vault 参照を設定済みの場合、
# 普通の環境変数として呼び出すだけでよい
# run.ps1
param($Request, $TriggerMetadata)
# Key Vault への接続コードが一切不要(Azure の大きな利点)
$connStr = $env:DB_CONNECTION_STRING # 自動的にシークレットの値が入る
$conn = New-Object System.Data.SqlClient.SqlConnection($connStr)
$conn.Open()
$cmd = $conn.CreateCommand()
$cmd.CommandText = "SELECT GETDATE()"
$result = $cmd.ExecuteScalar()
Write-Host "✅ 接続成功: $result"
$conn.Close()
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
StatusCode = [System.Net.HttpStatusCode]::OK
Body = "✅ Azure Functions(PS) から接続成功: $result"
})
Az モジュールを使って直接取得する場合:
# PaaS環境でもIaaSと同じコードで動作する(Azure の利点)
# Connect-AzAccount は不要(マネージドIDが自動で使われる)
$connStr = Get-AzKeyVaultSecret `
-VaultName "<KeyVault名>" `
-Name "DbConnectionString" `
-AsPlainText # IaaS と全く同じコード
5-4-B. OCI(PaaS × PowerShell)
OCI Functions は PowerShell を標準サポートしていないため、
カスタム Docker イメージを使用して実現します。
# func.ps1(OCI Functions カスタムコンテナ内で実行)
# ① リソース・プリンシパルで認証
# -AuthType ResourcePrincipal(IaaS の InstancePrincipal から変更が必要)
$bundle = Get-OCISecretsSecretBundle `
-SecretId $env:SECRET_ID_CONN `
-AuthType ResourcePrincipal # ← PaaS 専用
# ② Base64デコード(PaaSでも必須。Azure との違い)
$connStr = [System.Text.Encoding]::UTF8.GetString(
[System.Convert]::FromBase64String($bundle.SecretBundleContent.Content)
)
# ③ パスワードも同様に取得・デコード
$bundlePass = Get-OCISecretsSecretBundle `
-SecretId $env:SECRET_ID_PASS `
-AuthType ResourcePrincipal
$dbPass = [System.Text.Encoding]::UTF8.GetString(
[System.Convert]::FromBase64String($bundlePass.SecretBundleContent.Content)
)
# ④ Oracle Database に接続
$conn = New-Object Oracle.ManagedDataAccess.Client.OracleConnection(
"User Id=ADMIN;Password=$dbPass;Data Source=$connStr"
)
$conn.Open()
$cmd = $conn.CreateCommand()
$cmd.CommandText = "SELECT SYSDATE FROM DUAL"
$result = $cmd.ExecuteScalar()
Write-Host "✅ 接続成功: $result"
$conn.Close()
Write-Output "✅ OCI Functions(PowerShell) から接続成功: $result"
6. パターン別 比較一覧表
6-1. 認証プロバイダー比較
| パターン | Azure | OCI |
|---|---|---|
| IaaS × Java | DefaultAzureCredentialBuilder |
InstancePrincipalsAuthenticationDetailsProvider |
| IaaS × PowerShell | Connect-AzAccount -Identity |
Get-OCISecretsSecretBundle -AuthType InstancePrincipal |
| PaaS × Java |
DefaultAzureCredentialBuilder(IaaSと同一) |
ResourcePrincipalAuthenticationDetailsProvider |
| PaaS × PowerShell |
Get-AzKeyVaultSecret(IaaSと同一) |
Get-OCISecretsSecretBundle -AuthType ResourcePrincipal |
💡 Azure の特徴:IaaS・PaaSで認証コードが共通(
DefaultAzureCredentialが環境を自動判別)
💡 OCI の特徴:IaaS・PaaSで認証プロバイダーを明示的に使い分ける必要がある
6-2. シークレット取得メソッド比較
| パターン | Azure | OCI |
|---|---|---|
| IaaS × Java | client.getSecret("名前").getValue() |
client.getSecretBundle(request) → Base64デコード |
| IaaS × PowerShell | Get-AzKeyVaultSecret -AsPlainText |
Get-OCISecretsSecretBundle → Base64デコード |
| PaaS × Java | 環境変数 or IaaSと同じコード |
client.getSecretBundle(request) → Base64デコード |
| PaaS × PowerShell | 環境変数 or IaaSと同じコード |
Get-OCISecretsSecretBundle → Base64デコード |
6-3. PaaS 環境での環境変数注入比較
| 項目 | Azure | OCI |
|---|---|---|
| 仕組み |
Key Vault 参照(@Microsoft.KeyVault(...)) |
環境変数にシークレットの OCID を設定 |
| コードの変更 | 不要(環境変数として透過的に取得) | 必要(SDK でシークレットを取得しデコード) |
| 設定方法 | App Settings に参照構文を書くだけ | Functions設定変数にOCIDを登録し、コードで取得 |
| 利便性 | ★★★★★ | ★★★ |
6-4. 必要なライブラリ・モジュール比較
| パターン | Azure | OCI |
|---|---|---|
| Java 共通 |
azure-identity azure-security-keyvault-secrets
|
oci-java-sdk-secrets oci-java-sdk-common-httpclient-jersey
|
| Java DB接続 | mssql-jdbc |
ojdbc11 |
| PowerShell 共通 |
Az モジュール(Install-Module Az) |
OCI.PSModules または OCI.PSModules.Secrets
|
| PaaS PowerShell | App Service / Functions で標準サポート | カスタム Docker イメージが必要 |
7. セキュリティ設計の比較
7-1. ネットワーク経路の保護
| 項目 | Azure | OCI |
|---|---|---|
| プライベート通信の仕組み | プライベートエンドポイント | サービス・ゲートウェイ |
| 設定方法 | Key Vault のネットワーク設定でパブリックアクセスを無効化 | ルートテーブルにサービス・ゲートウェイ経由のルートを追加 |
| 通信経路 | VNet 内のプライベートIPアドレス経由 | VCN 内のオラクル内部ネットワーク経由 |
7-2. シークレットの保護機能比較
| 機能 | Azure | OCI |
|---|---|---|
| 論理削除(誤削除保護) | ソフト削除(Soft Delete):デフォルト有効 | 削除スケジュール制:即時削除不可 |
| 完全削除の防止 | 消去保護(Purge Protection):任意で有効化 | (削除スケジュールで代替) |
| バージョン管理 | シークレットのバージョン履歴を保持 | シークレットのバージョン履歴を保持 |
| ローテーション | Event Grid 連携で自動ローテーション可能 | ローテーションルールを設定可能 |
| 監査ログ | Azure Monitor / Diagnostic Settings | OCI Audit Service |
8. 開発・運用上の注意点まとめ
8-1. Azure 固有の注意点
✅ メリット
- IaaS/PaaS で認証コードが共通(DefaultAzureCredential が自動判別)
- PaaS では Key Vault 参照により SDK コードが不要
- シークレットは平文で返却されるためデコード処理不要
⚠️ 注意点
- マネージドIDの有効化を忘れると認証エラーになる
- RBAC ロール割り当ての反映に数分かかる場合がある
- Key Vault 名はグローバルで一意である必要がある
8-2. OCI 固有の注意点
✅ メリット
- サービス・ゲートウェイで完全にプライベートな通信が可能
- 動的グループのルールで複数VMを柔軟にグループ管理できる
- テナント全体での細かなポリシー制御が可能
⚠️ 注意点
- シークレット取得後に必ず Base64 デコードが必要(最重要)
- IaaS と PaaS で異なる認証プロバイダーを使い分ける必要がある
- 動的グループ+ポリシーの2ステップ設定が必要(Azure より手順が多い)
- PaaS での PowerShell 利用はカスタム Docker イメージが必要
- シークレットのOCIDをアプリに渡す仕組みを別途設計する必要がある
9. 移植・切り替え時のチェックリスト
Azure から OCI へ移行する場合、または並行運用する場合の確認事項です。
コード変更が必要な箇所
-
認証プロバイダーのクラス名変更
-
DefaultAzureCredentialBuilder→InstancePrincipalsAuthenticationDetailsProvider(IaaS) -
DefaultAzureCredentialBuilder→ResourcePrincipalAuthenticationDetailsProvider(PaaS)
-
- シークレット取得後に Base64デコード処理を追加(最重要)
-
Key Vault の URL 形式の変更
- Azure:
https://<名前>.vault.azure.net/ - OCI: シークレットを OCID で直接指定
- Azure:
-
DB接続ライブラリの変更(
mssql-jdbc→ojdbc11) - 接続文字列の形式変更(SQL Server 形式 → Oracle JDBC 形式)
インフラ設定の変更が必要な箇所
- マネージドIDの設定 → 動的グループ+ポリシーの設定に変更
- RBAC ロール割り当て → OCI ポリシー文に変更
- Key Vault 参照(環境変数)→ シークレットOCIDを環境変数に変更
- プライベートエンドポイント → サービス・ゲートウェイに変更
10. 全パターン比較サマリー
| 比較項目 | Azure IaaS Java | Azure IaaS PS | Azure PaaS Java | Azure PaaS PS | OCI IaaS Java | OCI IaaS PS | OCI PaaS Java | OCI PaaS PS |
|---|---|---|---|---|---|---|---|---|
| 認証コードの共通化 | ✅ | ✅ | ✅(IaaSと同一) | ✅(IaaSと同一) | ❌ | ❌ | ❌(別プロバイダー) | ❌(別AuthType) |
| デコード処理の要否 | 不要 | 不要 | 不要 | 不要 | 必要 | 必要 | 必要 | 必要 |
| コードなし環境変数注入 | ❌ | ❌ | ✅(KV参照) | ✅(KV参照) | ❌ | ❌ | ❌ | ❌ |
| PaaS標準サポート | ✅ | ✅ | ✅ | ✅ | ✅ | ❌(Docker必要) | ✅ | ❌(Docker必要) |
| 権限設定の手順数 | 少ない(1step) | 少ない(1step) | 少ない(1step) | 少ない(1step) | 多い(2step) | 多い(2step) | 多い(2step) | 多い(2step) |