> For the complete documentation index, see [llms.txt](https://rfc1918.gitbook.io/offsec/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rfc1918.gitbook.io/offsec/cloud/azure/enumeration/microsoft-graph-powershell.md).

# Microsoft Graph PowerShell

The Microsoft Graph PowerShell SDK acts as an API wrapper for the Microsoft Graph APIs, exposing the entire API set for use in PowerShell.

## Authentication

### Refresh Token

> Using TokenTactic

{% code overflow="wrap" %}

```powershell
$secure_token = ((Invoke-RefreshToMSGraphToken -domain oilcorporation.onmicrosoft.com -refreshToken $(cat .\refresh_token.txt)).access_token | ConvertTo-SecureString -AsPlainText -Force)
```

{% endcode %}

Authenticate with Connect-MgGraph.

```powershell
Connect-MgGraph -AccessToken $secure_token
```
