Skip to content

Instantly share code, notes, and snippets.

@kevinblumenfeld
Last active June 7, 2023 13:44
Show Gist options
  • Save kevinblumenfeld/35c99b367eb1d5b0fe5c7357d5ee3e4a to your computer and use it in GitHub Desktop.
Save kevinblumenfeld/35c99b367eb1d5b0fe5c7357d5ee3e4a to your computer and use it in GitHub Desktop.
## Usage
# GUI that saves and encrypts credentials that generate Bearer Token (Run this once per app registration)
# If application-only Graph API Permision, click "Export Tenant Config" button
# If also (or only) delegate permissions click both "Export Tenant Config" and "Export Tenant Credentials" buttons
# Copy the last command output from the GUI. This is how you connect each time.
Add-GraphConfig -Tenant Contoso -workload DescribePermissions
# GUI will provide exactly what to use to connect
Connect-Graph -Tenant Contoso -Workload DescribePermissions #use -Delegated switch if needed
## Gists
# Add-GraphConfig
https://gist.github.com/kevinblumenfeld/9fcc75db87b3519c922403a4ca5f8ae0
# Connect-Graph
https://gist.github.com/kevinblumenfeld/3317bcae617da54c781e5849bccf1b99
# Connect-GraphRefresh
https://gist.github.com/kevinblumenfeld/74ed39c87c233d258f9b4ec418607e10
# use in functions
if ([datetime]::UtcNow -ge $RefreshTime) { Connect-GraphRefresh }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment