# Add-MtReportAttachment

Embeds an HTML report from another tool, or data for a built-in report view, in the Maester HTML report.

Source: https://maester.dev/docs/commands/Add-MtReportAttachment

## SYNOPSIS

Embeds an HTML report from another tool, or data for a built-in report view, in the Maester HTML report.

## SYNTAX

### Path (Default)

```powershell
Add-MtReportAttachment -Name <String> -Path <String> [-ContentType <String>]
 [-ProgressAction <ActionPreference>] [<CommonParameters>]
```

### Content

```powershell
Add-MtReportAttachment -Name <String> -Content <String> [-ContentType <String>]
 [-ProgressAction <ActionPreference>] [<CommonParameters>]
```

## DESCRIPTION

Call this from a test, an instance source or a pack when the tool it runs writes its own single-file
HTML report (for example the Microsoft Zero Trust Assessment).
The file is read at once, so the tool's
output folder can be deleted afterwards.

The HTML report shows a button for each HTML attachment on the overview page, and on the result of the test
that added it.
The button shows the attached report inside the Maester report, beside its navigation, with an option to open it in a new browser tab.
The report is stored compressed
(gzip, then Base64), so a 10 MB report adds about 2 MB to the Maester report.

With -ContentType application/json the attachment is data that a built-in view of the report reads, found by
its Name (for example 'zero-trust-workshop', the Zero Trust plan of the Zero Trust Assessment pack).
A JSON
attachment is not shown as a button.
It is stored compressed in the same way.

Attachments are kept only in the HTML report and the results that Invoke-Maester -PassThru returns.
The
JSON results file lists each attachment's name and size without its content.
When -RedactUserIdentity is
used, the HTML report redacts JSON attachments the way it redacts the results, and leaves HTML attachments
out, because Maester cannot redact another tool's report.

The attached page runs in a sandboxed frame, with its scripts in an origin of their own, so it cannot read or
change the Maester report or its data.
Adding a second attachment with the same name from the same test
replaces the first.

## EXAMPLES

### EXAMPLE 1

```powershell
Add-MtReportAttachment -Name 'Zero Trust Assessment' -Path ./zt/ZeroTrustAssessmentReport.html
```

Embeds the Zero Trust Assessment report in the Maester report of this run.

### EXAMPLE 2

```powershell
Add-MtReportAttachment -Name 'Tenant inventory' -Content $html
```

Embeds an HTML page built in memory.

### EXAMPLE 3

```powershell
Add-MtReportAttachment -Name 'zero-trust-workshop' -Content $json -ContentType 'application/json'
```

Adds data for the report's Zero Trust plan view.

## PARAMETERS

### -Name

The label of the button that opens the attachment, for example 'Zero Trust Assessment'.
For a JSON
attachment, the name the report view reads it by, for example 'zero-trust-workshop'.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Path

Path of a single-file HTML report to embed.

```yaml
Type: String
Parameter Sets: Path
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Content

The HTML or JSON to embed, when it is not in a file.

```yaml
Type: String
Parameter Sets: Content
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -ContentType

text/html (the default) for a report the user opens from a button; application/json for data that a
built-in view of the report reads.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: Text/html
Accept pipeline input: False
Accept wildcard characters: False
```

### -ProgressAction

Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by Write-Progress.

```yaml
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

## OUTPUTS

### System.Void

## NOTES

## RELATED LINKS

[https://maester.dev/docs/commands/Add-MtReportAttachment](https://maester.dev/docs/commands/Add-MtReportAttachment)
