> 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/dev-reference/report-functions/get-rjrbbrandingmailparams.md).

# Get-RjRbBrandingMailParams

RJReport.Branding の Tenant 設定を、Send-RjRbReportEmail ですぐ使用できるパラメーターに解決します。

## 概要

`Get-RjRbBrandingMailParams` 中央の [メール ブランディング設定](https://docs.realmjoin.com/ja/zi-dong-hua/runbooks/runbook-report-settings.md#email-branding-optional) および [`Send-RjRbReportEmail`](https://docs.realmjoin.com/ja/dev-reference/report-functions/send-rjrbreportemail.md): 設定には **URL が**含まれており、送信関数は **ローカル ファイル パスを**想定します。この関数は、構成済みの画像をダウンロードし、それらを検証して、送信呼び出しにそのままスプラットできるハッシュテーブルを返します。

> **RealmJoin.RunbookHelper 0.8.9 から利用できます。** それ以前の runbook バージョンでは、このロジックは同名のインライン ヘルパーとして組み込まれていました。Automation Account が 0.8.9 以降で実行されるようになったら、それらのコピーは削除できます。

設計ルール:

* **レポートを失敗させることはありません。** 空の設定、HTTPS ではない URL、ダウンロード失敗、サイズ超過ファイル、無効な画像、形式不正な色など、どの問題でも警告となり、その単一のキーは省略されます。その後、メールは対応する RealmJoin の既定値で描画されます。
* **解決できたものだけを返します。** 返されるハッシュテーブルには成功したキーだけが含まれるため、これをスプラットしても空の値で既定値を上書きすることはありません。
* **1 回の実行につき 1 回のダウンロードです。** 1 回呼び出して、その結果を runbook が送信するすべてのメールで再利用してください。複数のユーザーに通知するループの内側でも同様です。

## クイック スタート

```powershell
$brandingMailParams = Get-RjRbBrandingMailParams `
    -HeaderImageUrl $BrandingHeaderImageUrl `
    -FooterImageUrl $BrandingFooterImageUrl `
    -FooterLink     $BrandingFooterLink `
    -AccentColor    $BrandingAccentColor `
    -TextColor      $BrandingTextColor

Send-RjRbReportEmail `
    -EmailFrom       $EmailFrom `
    -EmailTo         $EmailTo `
    -Subject         $Subject `
    -MarkdownContent $reportMd `
    @brandingMailParams
```

ブランディングが設定されていない場合、 `$brandingMailParams` は空のハッシュテーブルになり、呼び出しはパラメーターを省略した場合とまったく同じように動作します。

## パラメーター

すべてのパラメーターは省略可能です — この関数は、Tenant に設定されている内容に応じて呼び出せるよう設計されています。

| パラメーター           | 型        | 既定値     | 説明                                                                                   |
| ---------------- | -------- | ------- | ------------------------------------------------------------------------------------ |
| `HeaderImageUrl` | `string` | —       | ヘッダー画像の公開 HTTPS URL (`RJReport.Branding.HeaderImageUrl`).                            |
| `FooterImageUrl` | `string` | —       | フッター画像の公開 HTTPS URL (`RJReport.Branding.FooterImageUrl`).                            |
| `FooterLink`     | `string` | —       | フッター画像のリンク先 URL (`RJReport.Branding.FooterLink`)。そのまま渡され、検証はされません。                   |
| `AccentColor`    | `string` | —       | アクセント カラー (`RJReport.Branding.AccentColor`)。そのまま渡されます。16進形式は `Send-RjRbReportEmail`. |
| `TextColor`      | `string` | —       | テキスト カラー (`RJReport.Branding.TextColor`と同じ扱いです。 `AccentColor`.                       |
| `TimeoutSec`     | `int`    | `30`    | 画像ごとのダウンロード タイムアウト。                                                                  |
| `MaxImageBytes`  | `long`   | `200KB` | 許容される最大画像サイズ。ブランディング画像はレポート添付ファイルと約 4 MB の `sendMail` 上限を共有します。                      |

## 出力

成功した解決済みキーのみを含む `[hashtable]` です:

| キー            | 値                       |
| ------------- | ----------------------- |
| `HeaderImage` | ダウンロードされたヘッダー画像のローカル パス |
| `FooterImage` | ダウンロードされたフッター画像のローカル パス |
| `FooterLink`  | トリム済みのフッター リンク          |
| `AccentColor` | トリム済みのアクセント カラー         |
| `TextColor`   | トリム済みのテキスト カラー          |

各キーは `Send-RjRbReportEmail`のパラメーターに対応しているため、スプラッティングは安全です。

## 検証

各画像は、受け入れられる前に次のチェックを通過します:

| チェック       | 拒否理由                                                                                     |
| ---------- | ---------------------------------------------------------------------------------------- |
| URL スキーム   | 受け入れられるのは `https` のみです — 画像バイトは会社のメール内に入るため、プレーン HTTP は拒否されます。                           |
| ダウンロード     | 2xx 以外の応答、タイムアウト、ネットワーク エラーはすべて捕捉されます。ストレージ エラーのレスポンス本文は、画像として黙って扱われることはありません。           |
| サイズ        | 空のファイルと `MaxImageBytes` (既定 200 KB) を超えるファイル。                                            |
| ファイル シグネチャ | 先頭バイトで PNG、JPEG、GIF のいずれかであることを識別できなければなりません。 `.png` という名前で保存された HTML エラー ページはここで拒否されます。 |

一時ファイルには、その **検出された** 形式に一致する拡張子が付けられます。 `Send-RjRbReportEmail` これは添付ファイルのコンテンツ タイプをそこから導出するためです。そのため、ファイル拡張子のない URL や誤解を招く拡張子を持つ URL でも正しく動作します。

## 動作メモ

### 画像のホスト

URL は Azure Automation サンドボックスから到達可能である必要があるだけです。よくあるパターンは 2 つあります:

* **公開 blob または CDN** — 最も簡単ですが、画像は誰でも閲覧できます。
* **URL に SAS Token を含むプライベート コンテナー** — コンテナーは非公開のままで、リンクを持つ人だけが読み取れます。SAS の有効期限が切れるとブランディングは静かに無効になることを忘れないでください。期限切れ後はレポートは RealmJoin の既定値のまま届き続け、理由はジョブ ログの警告としてのみ表示されます。

### 一時ファイルのクリーンアップ

ダウンロードされた画像はサンドボックスの一時ディレクトリに書き込まれます。サンドボックスは実行後に破棄されるため、クリーンアップは任意です — ただし、明示的なクリーンアップ領域を持つ runbook では、最後のメール送信後に削除する必要があります:

```powershell
foreach ($brandingKey in @('HeaderImage', 'FooterImage')) {
    if ($brandingMailParams -and $brandingMailParams.ContainsKey($brandingKey) -and (Test-Path -LiteralPath $brandingMailParams[$brandingKey])) {
        Remove-Item -LiteralPath $brandingMailParams[$brandingKey] -Force -ErrorAction SilentlyContinue
    }
}
```

### ブランディングが表示されない場合の診断

ブランディングが設定されているのにレポートが既定のグラフィックで届く場合、ジョブ ログに失敗した段階が記録されます:

| ログ エントリ                                   | 原因                                                                           |
| ----------------------------------------- | ---------------------------------------------------------------------------- |
| なし `Branding:` のエントリ自体                    | 設定が runbook に届いていません — カスタマイズ JSON と、ポータルがこの runbook バージョンを認識しているかを確認してください。 |
| `HTTPS URL のみがサポートされます`                   | URL は `http://`.                                                             |
| 次のようなストレージ エラー `PublicAccessNotPermitted` | 認証されていないリクエストが届きました — URL から SAS Token が欠落しています。多くの場合、コピー時に切り詰められたことが原因です。   |
| `はインライン メール画像の … 制限を超えています`               | ファイルが `MaxImageBytes`.                                                       |
| `PNG、JPEG、GIF 画像ではありません`                  | ダウンロード結果が画像以外でした。通常はエラー ページです。                                               |

## 関連項目

* [Send-RjRbReportEmail](https://docs.realmjoin.com/ja/dev-reference/report-functions/send-rjrbreportemail.md) — 返されたパラメーターの利用側。
* [Runbook レポート設定](https://docs.realmjoin.com/ja/zi-dong-hua/runbooks/runbook-report-settings.md#email-branding-optional) — `RJReport.Branding.*` 設定を管理者として構成すること。


---

# 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/dev-reference/report-functions/get-rjrbbrandingmailparams.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.
