# Installation guide

Source: https://maester.dev/docs/installation

Maester needs **PowerShell 7.4 or later** on Windows, Linux or macOS. Windows PowerShell 5.1 is not supported.

- Install the **Maester** PowerShell module.

<InstallCommand />

The tests ship inside the module, so there is nothing else to download and no folder to set up.

- Sign into your Microsoft 365 tenant and run the tests.

```powershell
Connect-Maester
Invoke-Maester
```

You only need a folder if you want to change settings or add your own tests. Put a `maester-config.json` (see [Configuration](configuration/overview.md)) and a `custom` folder for your tests (see [Writing custom tests](writing-tests/index.mdx)) in it, and run `Invoke-Maester -Path <folder>` or run Maester from that folder.

:::note[Pester]
Maester 3.0 does not need Pester. Install it only if you have custom tests written in the Pester format (`*.Tests.ps1`), see [Pester-format tests](writing-tests/pester-format-tests.md):

```powershell
Install-Module Pester -MinimumVersion 5.7.1 -SkipPublisherCheck -Force -Scope CurrentUser
```
:::

Upgrading from Maester 2.x? See [Upgrading from 2.x](upgrading-from-2x.md).

## Invoke-Maester

To learn more about the `Invoke-Maester` cmdlet including how to filter tests, see the [Invoke-Maester](commands/Invoke-Maester.mdx) documentation and the [run configuration reference](configuration/run-configuration.md).

## Optional modules and permissions

Maester includes optional [CISA](tests/cisa/) tests that require additional permissions and modules to run. These optional tests are skipped if the modules are not installed or there is no active connection.

> Also see [Create-entra-app](sections/create-entra-app.md)

### Installing Azure, Exchange Online, Teams and PnP.PowerShell modules

```powershell
Install-Module Az.Accounts, ExchangeOnlineManagement, MicrosoftTeams, PnP.PowerShell -Scope CurrentUser
```

> The Security & Compliance PowerShell module is dependent on the ExchangeOnlineManagement `Connect-IPPSSession` cmdlet.

### Connecting to Azure, Exchange, and other services

In order to run all the CISA tests, you need to connect to the Azure, Exchange Online, and other modules.

For a more detailed introduction to these concepts see the [Connect-Maester](connect-maester/readme.md) documentation.

Run the following command to interactively connect to the Azure, Microsoft Graph, Exchange Online, and other modules. A sign-in window will appear for each module.

```powershell
Connect-Maester -Service All
```

### Connecting to GitHub

GitHub is an optional connection for GitHub security tests and is not included in `Connect-Maester -Service All`.
For interactive sessions, use the Maester GitHub App OAuth flow:

```powershell
Connect-Maester -Service Graph,GitHub -GitHubOrganization '<github-organization>'
```

See [Connect to GitHub (optional)](connect-maester/readme.md#connect-to-github-optional) for GitHub App install/approval details and token-based automation options.

### Permissions

Exchange Online implements a [role-based access control model](https://learn.microsoft.com/exchange/permissions-exo/permissions-exo). The controls these cmdlets test require minimum roles of either of the following:

* View-Only Configuration OR
* O365SupportViewConfig

### Installing Azure DevOps PowerShell module

```powershell
Install-Module ADOPS -Scope CurrentUser
```

### Connecting to Azure DevOps

In order to run all the Azure DevOps tests, you need to connect to Azure DevOps.

Use [Connect-Maester](connect-maester/readme.md#connect-to-azure-devops-optional) with the `AzureDevOps` service. It imports the optional `ADOPS` module and reuses an Az context when one exists or signs you in interactively.

```powershell
Connect-Maester -Service Graph,AzureDevOps -AzureDevOpsOrganization 'contoso'
```

You can also connect with the `ADOPS` module directly. A sign-in window will appear.

```powershell
Import-Module ADOPS
Connect-ADOPS -Organization 'contoso'
```

Some Azure DevOps checks use unsupported APIs. Those checks pass `-Force` to the relevant ADOPS commands; no module-wide opt-in is needed.

### Permissions

Azure DevOps implements a [role-based access control model](https://learn.microsoft.com/en-us/azure/devops/organizations/security/permissions?view=azure-devops&tabs=preview-page). The controls these cmdlets test require the minimum role of:

* Project-Scoped Users at Organization level

## Next Steps

- Monitoring with Maester
  - [Set up Maester on GitHub](monitoring/github.md)
  - [Set up Maester on Azure DevOps](monitoring/azure-devops.md)
  - [Set up Maester on Azure Container App Jobs](monitoring/azure-container-app-job.md)
- Alerting with Maester
  - [Set up Maester email alerts](alerts/email.md)
  - [Set up Maester Teams alerts](alerts/teams.md)
  - [Set up Maester Slack alerts](alerts/slack.md)
- [Writing Custom Tests](writing-tests/index.mdx)
