> For the complete documentation index, see [llms.txt](https://docs.realmjoin.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.realmjoin.com/ja/zhan-kai/infrastructure/moving-azure-resources.md).

# Azure リソースを別のサブスクリプションに移動する

RealmJoin に接続された Azure リソース（Key Vault、Log Analytics Workspace、Automation Account、Workplace Cloud Storage）を別の Azure サブスクリプションに移動するための推奨事項。

{% hint style="warning" %}
**このページは推奨事項であり、サポート対象の移行サービスではありません。** ここで説明する Azure リソースは、お使いのサブスクリプション内にあり、あなたが管理します。RealmJoin はそれらに接続するだけです。移動自体は Azure の操作であり、あなたの責任です。RealmJoin サポートは限定的にしか支援できず、主に移動後にリソースを RealmJoin に再接続する部分です。Azure の移動自体に関する問題は、Microsoft サポートにお問い合わせください。
{% endhint %}

## 概要

Azure を使用 **Move → 別のサブスクリプションへ移動** 各リソースには Azure の Move 機能を使用し、新しいものは作成しません。移動しても名前、エンドポイント、データはそのままなので、RealmJoin へのほとんどの接続はこれまでどおり機能します。

| リソース                                                | RealmJoin で使用するため        | 移動後に行うこと                                  |
| --------------------------------------------------- | ------------------------ | ----------------------------------------- |
| [Key Vault](#key-vault-laps)                        | LAPS パスワード               | RealmJoin では何もしません — 確認のみ                 |
| [Log Analytics Workspace](#log-analytics-workspace) | 監査ログ、運用ログ、および runbook ログ | 再度実行 `Set-RJLogAnalyticsWorkspace` 新しい対象で |
| [Automation Account](#automation-account-runbooks)  | Runbooks                 | 再度実行 `Set-RJAutomationAccount` 新しい対象で     |
| [Storage Account](#workplace-cloud-storage)         | Workplace クラウド ストレージ     | RealmJoin では何もしません — 確認のみ                 |

## 一般的な考慮事項

* **同じ Entra ID Tenant。** このページでは、古いサブスクリプションと新しいサブスクリプションが同じ Microsoft Entra ID Tenant に属していることを前提としています。リソースを別の Tenant に移動するのは別のシナリオであり、ここでは扱いません。
* **移動し、再作成しないでください。** 新しいリソースには新しい名前、キー、または証明書が付きます。Key Vault では、既存の LAPS パスワードを復号できなくなることを意味します（下記参照）。
* **同じリージョン。** 移動ではリソースのリージョンは変わりません。ターゲットのリソース グループを **同じリージョン** に作成してください。移動するリソースと同じリージョンである必要があります。Automation Account ではこれが必須です（下記参照）。
* **ロール割り当ては移動しません。** 移動したリソースに直接割り当てられた Azure のロール割り当ては孤立し、再作成する必要があります。RealmJoin のセットアップ コマンドがこれを代わりに行います。
* **ブロッカー。** 開始前にリソース ロックを一時的に解除し、ターゲット サブスクリプションの Azure Policy を確認してください。Azure は各移動を検証し、ブロックしているものを報告します。
* **タイミング。** Log Analytics Workspace と Automation Account の移動は、静かな時間帯に計画し、その直後に再接続してください（それぞれのセクションを参照）。

Microsoft の [移動に関するガイダンス](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/move-resource-group-and-subscription) と、 [移動をサポートするリソース種類の一覧も参照してください](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/move-support-resources).

## Key Vault (LAPS)

RealmJoin は Key Vault の DNS 名のみを保存します。名前は移動中も同じままなので、RealmJoin LAPS は RealmJoin 側で何も変更しなくても引き続き動作します。

{% hint style="danger" %}
**Key Vault を新しいものに置き換えないでください。** LAPS パスワードは、 `realmjoin-master` 証明書で暗号化されており、その秘密キーはエクスポートできません。新しいボールトには新しい証明書が作成され、既存のパスワードは復号できなくなります。Key Vault のバックアップは同じサブスクリプション内でしか復元できないため、代替にはなりません。ボールトを再作成するということは、すべてのデバイス上のすべての LAPS アカウントを再作成することを意味します。
{% endhint %}

1. ボールトを移動します: **Key Vault → 概要 → Move → 別のサブスクリプションへ移動**。アクセス ポリシー（ [KeyVault](https://docs.realmjoin.com/ja/realmjoin-agent/realmjoin-client/local-admin-password-solution-laps/keyvault.md)を参照）はボールトとともに移動するため、再構成は不要です。VM ディスク暗号化に使用するボールトは移動できません。
2. 確認: 証明書 `realmjoin-master` がまだ存在し、少数のデバイスについては RealmJoin Portal で LAPS パスワードをまだ表示できること。

移動中、Azure は管理操作のみをブロックします。シークレットの読み取りと書き込みは引き続き機能します。

## Log Analytics Workspace

ワークスペース ID、ログ、および保持設定は同じままです。ただし、 [データ収集ルール](https://docs.realmjoin.com/ja/torogu/log-analytics.md#components) RealmJoin が **移動できません**。それらは古いサブスクリプションに残り、ワークスペースを指さなくなります。ワークスペース上の RealmJoin のロール割り当ても失われます。

{% hint style="warning" %}
移動の完了から下記の再接続までの間、RealmJoin はログを書き込めません。 **この期間の監査ログ エントリは後で配信されません。** ワークスペースは静かな時間帯に移動し、その直後に再接続してください。
{% endhint %}

1. 移動前に、ワークスペースからソリューションまたはリンクされた Automation Account がある場合は削除してください。Azure は、リンクされたサービスを含むワークスペースは移動しません。
2. ワークスペースを移動します: **Log Analytics workspace → 概要 → サブスクリプション: 変更**。データ収集ルール（`dcr-rj-*`）は選択しないでください。移動には少し時間がかかる場合があります。
3. RealmJoin Portal の **Organization → Features** (<https://portal.realmjoin.com/organization/features>）を使用して **スクリプト トークンを生成**してください。これには組織機能を編集する権限が必要で、トークンは限られた時間だけ有効です。
4. 次に示すコマンドを、新しく開いたローカルの PowerShell セッションで実行してください。Azure Cloud Shell ではなく、ローカルで実行してください。 **新しい** サブスクリプション ID とリソース グループ、および **既存の** ワークスペース名を使用します。ワークスペース名がないと、新しいワークスペースが作成されます。

   ```powershell
   $latest = [version](Find-Module RealmJoin -Repository PSGallery -ErrorAction Stop).Version
   if (-not (Get-Module -ListAvailable RealmJoin | Where-Object Version -ge $latest)) {
       Install-Module RealmJoin -Force -AllowClobber -ErrorAction Stop
   }
   Import-Module RealmJoin -Force
   Set-RJLogAnalyticsWorkspace -ResourceGroupName "<new resource group>" -WorkspaceName "<existing workspace name>" -SubscriptionId "<new subscription ID>" -Token "<script token>" 6>&1
   ```

   このコマンドは既存のワークスペースとそのデータには手を加えず、ワークスペースのリージョンに新しい Data Collection Rules を作成し、必要なロールを割り当て、新しい値を RealmJoin に登録します。Azure と PowerShell の前提条件は初期セットアップ時と同じです。詳細は [Azure Log Analytics Workspace の接続](https://docs.realmjoin.com/ja/torogu/log-analytics.md#prerequisites).
5. 次の **Settings → Log Analytics**、選択してください **Refresh** と **構成の問題を確認する**。その後、新しいエントリが表示されていることを確認します [Audit Log](https://docs.realmjoin.com/ja/torogu/audit-log.md).
6. 古いサブスクリプションの古いデータ収集ルールを削除します。

{% hint style="info" %}
**まだワークスペース ID と共有キーを使用していますか？** Azure は移動中にワークスペース キーを再生成するため、ログ記録は直ちに停止します。上記のようにセットアップ コマンドを実行してください。これにより、Tenant も Log Ingestion API に切り替わります（ [Log Ingestion API への移行](https://docs.realmjoin.com/ja/torogu/log-ingestion-api-migration.md)).
{% endhint %}

## Automation Account（Runbooks）

Runbook、スケジュール、変数、資格情報、およびマネージド ID は Automation Account とともに移動します。ただし RealmJoin はアカウントのサブスクリプションとリソース グループを保存しており、そのアカウントに対するロール割り当てを失うため、アカウントを再接続する必要があります。

{% hint style="warning" %}
ターゲットのリソース グループは **同じリージョンである必要があります** Automation Account と同じリージョンにしてください。セットアップ コマンドは、アカウントをそのリソース グループのリージョンに展開します。アカウントが再接続されるまで、RealmJoin は Runbook の同期や開始を行えません。
{% endhint %}

1. マネージド ID のオブジェクト ID（**Automation Account → アカウント設定 → ID**).
2. Automation Account が Log Analytics workspace にリンクされている場合（たとえば Update Management や Change Tracking 用）、まずこれらの機能を削除し、ワークスペースのリンクを解除してください。Microsoft によって説明されているとおり [Microsoft](https://learn.microsoft.com/en-us/azure/automation/how-to/move-account).
3. Automation Account をターゲットのリソース グループに移動します。
4. で説明したとおりにスクリプト トークンを生成します [Log Analytics Workspace](#log-analytics-workspace) （手順 3）。
5. 次に示すコマンドを、新しく開いたローカルの PowerShell セッションで実行してください。 **新しい** サブスクリプション ID とリソース グループ、および **既存の** Automation Account 名を使用します。

   ```powershell
   $latest = [version](Find-Module RealmJoin -Repository PSGallery -ErrorAction Stop).Version
   if (-not (Get-Module -ListAvailable RealmJoin | Where-Object Version -ge $latest)) {
       Install-Module RealmJoin -Force -AllowClobber -ErrorAction Stop
   }
   Import-Module RealmJoin -Force
   Set-RJAutomationAccount -ResourceGroupName "<new resource group>" -AutomationAccountName "<existing account name>" -SubscriptionId "<new subscription ID>" -Token "<script token>" 6>&1
   ```

   このコマンドは、そのアカウントに対する RealmJoin のロールを再度割り当て、新しい値を RealmJoin に登録します。Azure と PowerShell の前提条件は初期セットアップ時と同じです。 [Azure Automation の接続](https://docs.realmjoin.com/ja/zi-dong-hua/connecting-azure-automation.md#prerequisites).
6. 確認:
   * マネージド ID のオブジェクト ID は変更されていません。変更されている場合は、その [ロールとアクセス許可](https://docs.realmjoin.com/ja/zi-dong-hua/connecting-azure-automation/azure-ad-roles-and-permissions.md#granting-roles-and-permissions) を再度付与してください。
   * **設定 → Runbooks → 更新** に新しい値が表示され、Runbook の同期が完了します。
   * テスト Runbook が正常に実行されます。
   * もし [Hybrid Runbook Workers](https://docs.realmjoin.com/ja/zi-dong-hua/runbooks/hybrid-runbook-worker.md)を使用している場合、それらは引き続き接続されます。

## Workplace クラウド ストレージ

RealmJoin は接続文字列を使用して Storage Account に接続します。接続文字列にはアカウント名とアクセス キーが含まれます。移動中も両方とも同じままなので、お気に入り、背景、ファイル、署名の公開 URL は引き続き機能します。

1. Storage Account をターゲットのリソース グループに移動します。
2. 確認: RealmJoin Portal の **組織 → その他のファイル**でテスト ファイルをアップロードします。エラーが発生した場合は、 **Storage Account → アクセス キー** に保存します **設定 → Workplace クラウド ストレージ** （参照 [Workplace クラウド ストレージ](https://docs.realmjoin.com/ja/to/workplace-cloud-storage.md#create-storage-account)).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.realmjoin.com/ja/zhan-kai/infrastructure/moving-azure-resources.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
