/MyAAD

A simple powershell module for PSGraph using only built in powershell capabilities.

Primary LanguagePowerShellMIT LicenseMIT

MyAAD Module

Description

A pretty simple and straight forward Powershell Module for Microsoft Graph primarily created for managing groups and templates.

Installation

Either copy the Release/MyAAD to a directory of your choice or see install.

How to

Create app in Azure AD

First of you need to register an application in Azure AD and create secrets for it: instructions.

Fetch access token

# Enter Application ID as username and secret as password
$Credential = Get-Credential

# Get Access token
$AccessTokenResponse = Get-MyAADAccessToken -ClientCredential $Credential -TenantName contoso.onmicrosoft.com
$AccessToken = $AccessTokenResponse.access_token

Perform commands

# Fetch all unified groups
Get-MyAADUnifiedGroups -AccessToken $AccessToken

Functions

Description:

Gets a graph access token

Example:

PS C:\> Get-MyAADAccessToken -ClientCredential $Credential -TenantName contoso.onmicrosoft.com

Description:

Fetches all settings from templates etc from you AAD

Example:

PS C:\> Get-MyAADDirectorySettings -AccessToken $AccessToken

Description:

Fetches all AAD directory settings templates

Example:

PS C:\> Get-MyAADDirectorySettingTemplates -AccessToken $AccessToken

Description:

Fetches all settings applied for a specific group

Example:

PS C:\> Get-MyAADGroupSetting

Description:

Fetches all security alerts with the graph API

Example:

PS C:\> Get-MyAADSecurityAlerts

Description:

Fetches all unified groups from your AAD tenant

Example:

PS C:\> Get-MyAADUnifiedGroups -AccessToken $AccessToken

Description:

Creates a new Directory Settings object

Example:

PS C:\> $UnifiedGroupTemplate = Get-MyAADDirectorySettingTemplates -AccessToken $AccessToken | ? {$_.DisplayName -eq 'Group.Unified'}

Description:

Sets new group setting on group from a template.

Example:

PS C:\> $Settings = [PSCustomObject]@{

Description:

Removes specific settings object froup group

Example:

PS C:\> Remove-MyAADGroupSetting -Id $GroupId -SettingsId $SettingsIDGuid
PS C:\> $GroupSettings = Get-MyAADGroupSetting -AccessToken $AccessToken -Id $GroupId

Description:

Enables or disables guest access on specific group

Example:

PS C:\> Set-MyAADGroupGuestAccess -AllowAddGuests $False -AccessToken $AccessToken
PS C:\> Set-MyAADGroupGuestAccess -AllowAddGuests $True -AccessToken $AccessToken
PS C:\> $Groups | Set-MyAADGroupGuestAccess -AllowAddGuests $False -AccessToken $AccessToken

Description:

Updates a security alert

Example:

PS C:\> Update-MyAADSecurityAlert -AccessToken $AccessToken -Id $AlertId -AssignedTo Someone
PS C:\> $FilteredAlerts | Update-MyAADSecurityAlert -AccessToken $AccessToken -Id $AlertId -AssignedTo Someone