{"id":13742635,"url":"https://github.com/KnudsenMorten/MicrosoftGraphPS","last_synced_at":"2025-05-09T00:31:33.528Z","repository":{"id":184301202,"uuid":"671552071","full_name":"KnudsenMorten/MicrosoftGraphPS","owner":"KnudsenMorten","description":"Think of this PS-module as a helper for Microsoft Graph version-management, connectivity and data management using Microsoft Graph.","archived":false,"fork":false,"pushed_at":"2025-04-28T09:46:19.000Z","size":1076,"stargazers_count":13,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-28T10:43:32.641Z","etag":null,"topics":["connectivity","graph","microsoft","microsoftgraph","rest-api","versioning","versions"],"latest_commit_sha":null,"homepage":"https://github.com/KnudsenMorten/MicrosoftGraphPS","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KnudsenMorten.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-27T15:21:17.000Z","updated_at":"2025-04-28T09:46:25.000Z","dependencies_parsed_at":"2023-07-27T21:25:59.936Z","dependency_job_id":"f687de02-94e0-463d-b33f-0c7212064058","html_url":"https://github.com/KnudsenMorten/MicrosoftGraphPS","commit_stats":null,"previous_names":["knudsenmorten/microsoftgraphps"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KnudsenMorten%2FMicrosoftGraphPS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KnudsenMorten%2FMicrosoftGraphPS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KnudsenMorten%2FMicrosoftGraphPS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KnudsenMorten%2FMicrosoftGraphPS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KnudsenMorten","download_url":"https://codeload.github.com/KnudsenMorten/MicrosoftGraphPS/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253170954,"owners_count":21865273,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["connectivity","graph","microsoft","microsoftgraph","rest-api","versioning","versions"],"created_at":"2024-08-03T05:00:34.352Z","updated_at":"2025-05-09T00:31:32.915Z","avatar_url":"https://github.com/KnudsenMorten.png","language":"PowerShell","readme":"# MicrosoftGraphPS\nI'm really happy to announce my newest PS-module, **MicrosoftGraphPS**.\n\nThink of this PS-module as a helper for **Microsoft Graph version-management, connectivity** and **data management** using **Microsoft Graph**. It does also support **generic Microsoft REST API connectivity** and **data management** like https://api.securitycenter.microsoft.com/api/machines. Lastly, it includes new custom cmdlets I use often like Get-MgUser-AllProperties-AllUsers\n\n| Function Name                      | Funtionality                                                 |\n| ---------------------------------- | ------------------------------------------------------------ |\n| Manage-Version-Microsoft.Graph     | Version management of Microsoft.Graph PS modules\u003cbr/\u003eInstalling latest version of Microsoft.Graph, if not found\u003cbr/\u003eShows older installed versions of Microsoft.Graph\u003cbr/\u003eChecks if newer version if available from PSGallery of Microsoft.Graph\u003cbr/\u003eAutomatic clean-up old versions of Microsoft.Graph\u003cbr/\u003eUpdate to latest version from PSGallery of Microsoft.Graph\u003cbr/\u003eRemove all versions of Microsoft.Graph (complete re-install) |\n| InstallUpdate-MicrosoftGraphPS     | Install latest version of MicrosoftGraphPS, if not found\u003cbr/\u003eUpdate to latest version of MicrosoftGraphPS, if switch (-AutoUpdate) is set |\n| Connect-MicrosoftGraphPS           | Connect to Microsoft Graph using Azure App \u0026 Secret\u003cbr/\u003eConnect to Microsoft Graph using Azure App \u0026 Certificate Thumprint\u003cbr/\u003eConnect to Microsoft Graph using interactive login and scope |\n| Invoke-MgGraphRequestPS            | Invoke command with pagination support to get/put/post/patch/delete data using Microsoft Graph REST endpoint. |\n| Connect-MicrosoftRestApiEndpointPS | Connect to REST API endpoint like https://api.securitycenter.microsoft.com using Azure App \u0026 Secret |\n| Invoke-MicrosoftRestApiRequestPS   | Invoke command to get/put/post/patch/delete data using Microsoft REST API endpoint\u003cbr/\u003eGet data using Microsoft REST API endpoint like \u003cbr/\u003ehttps://api.securitycenter.microsoft.com/api/machines |\n| Get-MgUser-AllProperties-AllUsers  | Get all properties for all users\u003cbr/\u003eExpands manager information\u003cbr/\u003eExcludes certain properties which cannot be returned within a user collection in bulk retrieval\u003cbr/\u003e\u003cbr/\u003eThe following properties are only supported when retrieving a single user: aboutMe, birthday, hireDate, interests, mySite, pastProjects, preferredName, \u003cbr/\u003eresponsibilities, schools, skills, mailboxSettings, DeviceEnrollmentLimit, print, SignInActivity |\n\n\n\n## Download of MicrosoftGraphPS\n\nYou can [find MicrosoftGraph here](https://raw.githubusercontent.com/KnudsenMorten/MicrosoftGraphPS/main/MicrosoftGraphPS.psm1) - or from [Powershell Gallery using this link](https://www.powershellgallery.com/packages/MicrosoftGraphPS)\n\n\n\n## Version Management of MicrosoftGraphPS \u0026 Microsoft.Graph\n\n\n\n#### Install / Update MicrosoftGraphPS (pre-req to get access to functions)\n\nJust copy the entire script-code below into the beginning of your script - and change the variables according to your needs as outlined below.\n\n\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ch4\u003eComplete Script / Powershell code\u003c/h4\u003e\u003c/summary\u003e\n\n```\n##########################################################################################\n# Pre-req script for getting environment ready with Microsoft.Graph and MicrosoftGraphPS\n##########################################################################################\n\n\u003c#\n.SYNOPSIS\nInstall and Update MicrosoftGraphPS module\nVersion management of Microsoft.Graph PS modules\n\n.DESCRIPTION\n\nMicrosoftGraphPS:\n Install latest version of MicrosoftGraphPS, if not found\n Updates to latest version of MicrosoftGraphPS, if switch ($AutoUpdate) is set to $True\n\nMicrosoft.Graph:\n Installing latest version of Microsoft.Graph, if not found\n Shows older installed versions of Microsoft.Graph\n Checks if newer version if available from PSGallery of Microsoft.Graph\n Automatic clean-up old versions of Microsoft.Graph\n Update to latest version from PSGallery of Microsoft.Graph\n\n.AUTHOR\nMorten Knudsen, Microsoft MVP - https://mortenknudsen.net\n\n.LINK\nhttps://github.com/KnudsenMorten/MicrosoftGraphPS\n#\u003e\n\n# Variables\n$Scope      = \"AllUsers\"  # Valid parameters: AllUsers, CurrentUser\n$AutoUpdate = $True\n\n# Check if MicrosoftGraphPS is installed\n$ModuleCheck = Get-Module -Name MicrosoftGraphPS -ListAvailable -ErrorAction SilentlyContinue\n\nIf (!($ModuleCheck))    # MicrosoftGraphPS is NOT installed\n    {\n        # check for NuGet package provider\n        [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\n\n        Write-host \"\"\n        Write-host \"Checking Powershell PackageProvider NuGet ... Please Wait !\"\n            if (Get-PackageProvider -ListAvailable -Name NuGet -ErrorAction SilentlyContinue -WarningAction SilentlyContinue) \n                {\n                    Write-host \"\"\n                    Write-Host \"OK - PackageProvider NuGet is installed\"\n                } \n            else \n                {\n                    try\n                        {\n                            Write-host \"\"\n                            Write-Host \"Installing NuGet package provider .. Please Wait !\"\n                            Install-PackageProvider -Name NuGet -Scope $Scope -Confirm:$false -Force\n                        }\n                    catch [Exception] {\n                        $_.message \n                        exit\n                    }\n                }\n\n        Write-host \"Powershell module MicrosoftGraphPS was not found !\"\n        Write-Host \"\"\n        Write-host \"Installing latest version from PsGallery in scope $Scope .... Please Wait !\"\n        Write-Host \"\"\n\n        Install-module -Name MicrosoftGraphPS -Repository PSGallery -Force -Scope $Scope\n        import-module -Name MicrosoftGraphPS -Global -force -DisableNameChecking -WarningAction SilentlyContinue\n    }\n\n##########################################################################################\n# Install/Update/Cleanup Microsoft.Graph and MicrosoftGraphPS\n##########################################################################################\n\nIf ($AutoUpdate)\n    {\n        Manage-Version-Microsoft.Graph -InstallLatestMicrosoftGraph -CleanupOldMicrosoftGraphVersions -Scope $Scope\n    }\nElse\n    {\n        Manage-Version-Microsoft.Graph -Scope $Scope\n    }\n```\n\n\u003c/details\u003e\n\n\n\nYou can also [download the script here](https://raw.githubusercontent.com/KnudsenMorten/MicrosoftGraphPS/main/Install-Update-MicrosoftGraphPS-Microsoft.Graph.ps1). \n\nYou can run the pre-req code as part of your script and it will be able to update to latest version and remove old versions, if desired.\n\n\n\n#### Daily Automatic Update - can be used in a scheduled task\n\n```\nC:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -executionpolicy bypass -file .\\Install-Update-MicrosoftGraphPS-Microsoft.Graph.ps1\n```\n\n\n\n#### **Updating Microsoft Graph to latest version**\n\n```\n# Show details, install latest (if found) and clean-up old versions (if found)\nManage-Version-Microsoft.Graph -InstallLatestMicrosoftGraph -Scope AllUsers\n```\n\n![Connect](img/Prereq-0.jpg)\n\n\n\n#### **Clean-up older Microsoft Graph versions (except the latest available version)**\n\n```\n# Show details, install latest (if found) and clean-up old versions (if found)\nManage-Version-Microsoft.Graph -CleanupOldMicrosoftGraphVersions\n```\n\n![Removing](img/prereq-3.jpg)\n\n\n\n#### **Install, Update and Clean-up older Microsoft Graph versions (except the latest available version)**\n\n```\nManage-Version-Microsoft.Graph -InstallLatestMicrosoftGraph -CleanupOldMicrosoftGraphVersions -Scope AllUsers\n```\n\n\n\n#### **Force Re-install current Microsoft Graph version**\n\n```\nManage-Version-Microsoft.Graph -ForceReinstall\n```\n\n\n\n#### **Remove all Microsoft Graph versions**\n\n```\nManage-Version-Microsoft.Graph -RemoveAllMicrosoftGraphVersions\n```\n\n![Removing](img/remove.jpg)\n\n\n\n## MgGraph: Connectivity to Microsoft Graph using MicrosoftGraphPS\n\n\n\n#### MgGraph: Connectivity with App \u0026 Secret\n\n```\n# Microsoft Graph connect with AzApp \u0026 CertificateThumprint\nConnect-MicrosoftGraphPS -AppId $global:HighPriv_Modern_ApplicationID_Azure `\n                         -AppSecret $global:HighPriv_Modern_Application_Secret_Azure `\n                         -TenantId $global:AzureTenantID\n\nOutput:\nConnecting to Microsoft Graph using Azure App \u0026 Secret\nWelcome To Microsoft Graph!                         \n```\n\n\n\n#### MgGraph: Connectivity with App \u0026 CertificateThumbprint\n\n```\n# Microsoft Graph connect with AzApp \u0026 CertificateThumprint\nConnect-MicrosoftGraphPS -AppId $global:HighPriv_Modern_ApplicationID_Azure `\n                         -CertificateThumbprint $global:HighPriv_Modern_CertificateThumbprint_Azure `\n                         -TenantId $global:AzureTenantID\n\nOutput:\nConnecting to Microsoft Graph using Azure App \u0026 CertificateThumprint\nWelcome To Microsoft Graph!                         \n```\n\n\n\n#### MgGraph: Connectivity using interactive login and scopes\n\n```\n# Microsoft Graph connect with interactive login with the permission defined in the scopes\n$Scopes = @(\"DeviceManagementConfiguration.ReadWrite.All\",`\n            \"DeviceManagementManagedDevices.ReadWrite.All\",`\n            \"DeviceManagementServiceConfig.ReadWrite.All\"\n            )\nConnect-MicrosoftGraphPS -Scopes $Scopes\n```\n\n\n\n#### MgGraph: Show permissions in the current context\n\n```\n# Show Permissions in the current context\nConnect-MicrosoftGraphPS -ShowMgContextExpandScopes\n\nOutput:\nAgreement.ReadWrite.All\nTeamSettings.ReadWrite.All\nCustomSecAttributeDefinition.ReadWrite.All\nSecurityAlert.ReadWrite.All\nTeamMember.Read.All\n```\n\n\n\n#### MgGraph: Show context of current Microsoft Graph context\n\n```\n# Show context of current Microsoft Graph context\nConnect-MicrosoftGraphPS -ShowMgContext\n\nOutput:\nClientId               : 9283fsssssssss9a4f-2a9b521c91f9\nTenantId               : be2sssssssssa6-ae25-9b9db2c9061b\nScopes                 : {Agreement.ReadWrite.All, TeamSettings.ReadWrite.All, CustomSecAttributeDefinition.ReadWrite.All, SecurityAlert.ReadWrite.Al\n                         l...}\nAuthType               : AppOnly\nTokenCredentialType    : ClientSecret\nCertificateThumbprint  : \nCertificateSubjectName : \nAccount                : \nAppName                : xxxxxx - Automation - Azure\nContextScope           : Process\nCertificate            : \nPSHostVersion          : 5.1.17763.4644\nManagedIdentityId      : \nClientSecret           : System.Security.SecureString\nEnvironment            : Global\n```\n\n\n\n\n\n## MgGraph: Get data from Microsoft Graph using 2 methods: MgGraph REST endpoint or MgGraph Cmdlets (if available)\n\n\n\n#### MgGraph - Method 1: Invoke-MgGraphRequestPS GET with REST endpoint (supports pagination)\n\n```\n$Uri        = \"https://graph.microsoft.com/v1.0/devicemanagement/managedDevices\"\n$Devices    = Invoke-MgGraphRequestPS -Uri $Uri -Method GET -OutputType PSObject\n```\n\n\n\n#### MgGraph - Method 2 (prefered): MgGraph Cmdlets (if available)\n\n```\n$Devices = Get-MgDeviceManagementManagedDevice\n```\n\n\n\n## REST API: Connectivity to Microsoft REST API Endpoint using MicrosoftGraphPS\n\n\n\n#### REST API: Connectivity with App \u0026 Secret\n\n```\n$ConnectAuth = Connect-MicrosoftRestApiEndpointPS -AppId $global:HighPriv_Modern_ApplicationID_O365 `\n                                                  -AppSecret $global:HighPriv_Modern_Secret_O365 `\n                                                  -TenantId $global:AzureTenantID `\n                                                  -Uri \"https://api.securitycenter.microsoft.com\"                        \n```\n\n\n\n## REST API: Get data from REST API using MicrosoftGraphPS\n\n\n\n#### Get data from REST API like Defender for Endpoint (securitycenter api)\n\n```\nInvoke-MicrosoftRestApiRequestPS -Uri \"https://api.securitycenter.microsoft.com/api/machines\" `\n                                 -Method GET `\n                                 -Headers $ConnectAuth[1]\n```\n\n\n\n## Get-MgUser-AllProperties-AllUsers\n\nGet all properties for all users\nExpands manager information\nExcludes certain properties which cannot be returned within a user collection in bulk retrieval (*)\n\n(*)\nhttps://learn.microsoft.com/en-us/graph/api/user-list?view=graph-rest-1.0\u0026tabs=http#optional-query-parameters\n\nThe following properties are only supported when retrieving a single user: aboutMe, birthday, hireDate, interests, mySite, pastProjects, preferredName, \nresponsibilities, schools, skills, mailboxSettings, DeviceEnrollmentLimit, print, SignInActivity\n\n```\n$Result = Get-MgUser-AllProperties-AllUsers\n$Result | fl\n\nGetting all properties from all users in Entra ID (prior named Azure AD) .... Please Wait !\n```\n\n\n\n# **Synopsis for functions**\n\n\n\n## Manage-Version-Microsoft.Graph\n\n```\n.SYNOPSIS\nVersion management of Microsoft.Graph PS modules\n\n.DESCRIPTION\nInstalling latest version of Microsoft.Graph, if not found\nShows older installed versions of Microsoft.Graph\nChecks if newer version if available from PSGallery of Microsoft.Graph\nAutomatic clean-up old versions of Microsoft.Graph\nUpdate to latest version from PSGallery of Microsoft.Graph\nRemove all versions of Microsoft.Graph\n\n.AUTHOR\nMorten Knudsen, Microsoft MVP - https://mortenknudsen.net\n\n.LINK\nhttps://github.com/KnudsenMorten/MicrosoftGraphPS\n\n.PARAMETER Scope\nScope where MicrosoftGraphPS module will be installed - can be AllUsers (default) or CurrentUser\n        \n.PARAMETER CleanupOldMicrosoftGraphVersions\n[switch] Removes old versions, if any found\n\n.PARAMETER RemoveAllMicrosoftGraphVersions\n[switch] Removes all versions of Microsoft.Graph (complete re-install)\n\n.PARAMETER InstallLatestMicrosoftGraph\n[switch] Install latest version of Microsoft.Graph from PSGallery, if new version detected\n\n.PARAMETER ShowVersionDetails\n[switch] Show version details (detailed)\n\n.INPUTS\nNone. You cannot pipe objects\n\n.OUTPUTS\nReturns the data\n\n.EXAMPLE\n\n# Show details of installed Microsoft.Graph\nManage-Version-Microsoft.Graph\n\n# Show details of installed Microsoft.Graph including version details\nManage-Version-Microsoft.Graph -ShowVersionDetails\n\n# Show details of installed Microsoft.Graph and install latest (if found)\nManage-Version-Microsoft.Graph -InstallLatestMicrosoftGraph\n\n# Show details of installed Microsoft.Graph and install latest (if found)\nManage-Version-Microsoft.Graph -InstallLatestMicrosoftGraph -Scope CurrentUser\n\n# Show details of installed Microsoft.Graph and clean-up old versions (if found)\nManage-Version-Microsoft.Graph -CleanupOldMicrosoftGraphVersions\n\n# Show details of installed Microsoft.Graph and remove all versions (complete re-install)\nManage-Version-Microsoft.Graph -RemoveAllMicrosoftGraphVersions\n\n# Show details, install latest (if found) and clean-up old versions (if found)\nManage-Version-Microsoft.Graph -InstallLatestMicrosoftGraph -CleanupOldMicrosoftGraphVersions\n```\n\n\n\n## InstallUpdate-MicrosoftGraphPS\n\n```\n.SYNOPSIS\nInstall and Update MicrosoftGraphPS module\n\n.DESCRIPTION\nInstall latest version of MicrosoftGraphPS, if not found\nUpdates to latest version of MicrosoftGraphPS, if switch (-AutoUpdate) is set\n\n.AUTHOR\nMorten Knudsen, Microsoft MVP - https://mortenknudsen.net\n\n.LINK\nhttps://github.com/KnudsenMorten/MicrosoftGraphPS\n\n.PARAMETER Scope\nScope where MicrosoftGraphPS module will be installed - can be AllUsers or CurrentUser\n\n.PARAMETER AutoUpdate\nMicrosoftGraphPS module will be updated to latest version, if switch (-AutoUpdate) is set\n\n.INPUTS\nNone. You cannot pipe objects\n\n.OUTPUTS\nInstallation / Update status\n\n.EXAMPLE\n\nInstallUpdate-MicrosoftGraphPS -Scope AllUsers -AutoUpdate\n```\n\n\n\n## Connect-MicrosoftGraphPS\n\n    .SYNOPSIS\n    Connect to Microsoft Graph (requires PS-module Microsoft Graph minimum v2.x)\n        \n    .DESCRIPTION\n    Connect to Microsoft Graph using Azure App \u0026 Secret\n    Connect to Microsoft Graph using Azure App \u0026 Certificate Thumprint\n    Connect to Microsoft Graph using interactive login and scope\n    \n    .AUTHOR\n    Morten Knudsen, Microsoft MVP - https://mortenknudsen.net\n    \n    .LINK\n    https://github.com/KnudsenMorten/MicrosoftGraphPS\n    \n    .PARAMETER AppId\n    This is the Azure app id\n        \n    .PARAMETER AppSecret\n    This is the secret of the Azure app\n    \n    .PARAMETER TenantId\n    This is the Azure AD tenant id\n    \n    .PARAMETER CertificateThumbprint\n    This is the thumprint of the installed certificate\n    \n    .PARAMETER ShowMgContext\n    switch to show the current Microsoft Graph context\n    \n    .PARAMETER ShowMgContextExpandScopes\n    switch to show the Microsoft Graph permissions in the current context\n    \n    .PARAMETER Scopes\n    Here you can define an array of permissions\n    \n    .INPUTS\n    None. You cannot pipe objects\n    \n    .OUTPUTS\n    Connection to Microsoft Graph (\"welcome\")\n    \n    .EXAMPLE\n    \n    # Microsoft Graph connect with AzApp \u0026 Secret\n    Connect-MicrosoftGraphPS -AppId $global:HighPriv_Modern_ApplicationID_Azure `\n                             -AppSecret $global:HighPriv_Modern_Secret_Azure `\n                             -TenantId $global:AzureTenantID\n    \n    # Microsoft Graph connect with AzApp \u0026 CertificateThumprint\n    Connect-MicrosoftGraphPS -AppId $global:HighPriv_Modern_ApplicationID_Azure `\n                             -CertificateThumbprint $global:HighPriv_Modern_CertificateThumbprint_Azure `\n                             -TenantId $global:AzureTenantID\n    \n    # Show Permissions in the current context\n    Connect-MicrosoftGraphPS -ShowMgContextExpandScopes\n    \n    # Show context of current Microsoft Graph context\n    Connect-MicrosoftGraphPS -ShowMgContext\n    \n    # Microsoft Graph connect with interactive login with the permission defined in the scopes\n    $Scopes = @(\"DeviceManagementConfiguration.ReadWrite.All\",`\n                \"DeviceManagementManagedDevices.ReadWrite.All\",`\n                \"DeviceManagementServiceConfig.ReadWrite.All\"\n                )\n    Connect-MicrosoftGraphPS -Scopes $Scopes\n\n\n\n## Invoke-MgGraphRequestPS\n\n    .SYNOPSIS\n    Invoke command to get/put/post/patch/delete data using Microsoft Graph REST endpoint\n    \n    .DESCRIPTION\n    Get data using Microsoft Graph REST endpoint in case there is no PS-cmdlet available\n    \n    .AUTHOR\n    Morten Knudsen, Microsoft MVP - https://mortenknudsen.net\n    \n    .LINK\n    https://github.com/KnudsenMorten/MicrosoftGraphPS\n    \n    .PARAMETER Uri\n    This is the Uri for the REST endpoint in Microsoft Graph\n    \n    .PARAMETER Method\n    This is the method to handle the data (GET, PUT, DELETE, POST, PATCH)\n    \n    .PARAMETER OutPutType\n    This is the output type\n    \n    .INPUTS\n    None. You cannot pipe objects\n    \n    .OUTPUTS\n    Returns the data\n    \n    .EXAMPLE\n    # Method #1 - REST Endpoint\n    $Uri        = \"https://graph.microsoft.com/v1.0/devicemanagement/managedDevices\"\n    $Devices    = Invoke-MgGraphRequestPS -Uri $Uri -Method GET -OutputType PSObject\n    \n    # Method #2 - MgGraph cmdlet (prefered method, if available)\n    $Devices = Get-MgDeviceManagementManagedDevice\n    $Devices\n\n\n\n## Connect-MicrosoftRestApiEndpointPS\n\n    .SYNOPSIS\n    Connect to REST API endpoint\n    \n    .DESCRIPTION\n    Connect to REST API endpoint like https://api.securitycenter.microsoft.com\n    \n    .AUTHOR\n    Morten Knudsen, Microsoft MVP - https://mortenknudsen.net\n    \n    .LINK\n    https://github.com/KnudsenMorten/MicrosoftGraphPS\n    \n    .PARAMETER Uri\n    This is the Uri for the REST endpoint in Microsoft Graph\n    \n    .PARAMETER AppId\n    This is the Azure app id\n            \n    .PARAMETER AppSecret\n    This is the secret of the Azure app\n    \n    .PARAMETER TenantId\n    This is the Azure AD tenant id\n    \n    .INPUTS\n    None. You cannot pipe objects\n    \n    .OUTPUTS\n    Connection Header \u0026 Token\n    \n    .EXAMPLE\n    $ConnectAuth = Connect-MicrosoftRestApiEndpointPS -AppId $global:HighPriv_Modern_ApplicationID_O365 `\n                                                      -AppSecret $global:HighPriv_Modern_Secret_O365 `\n                                                      -TenantId $global:AzureTenantID `\n                                                      -Uri \"https://api.securitycenter.microsoft.com\"\n\n\n\n## Invoke-MicrosoftRestApiRequestPS\n\n```\n.SYNOPSIS\nInvoke command to get/put/post/patch/delete data using Microsoft REST API endpoint\n\n.DESCRIPTION\nGet data using Microsoft REST API endpoint like GET https://api.securitycenter.microsoft.com/api/machines\n\n.AUTHOR\nMorten Knudsen, Microsoft MVP - https://mortenknudsen.net\n\n.LINK\nhttps://github.com/KnudsenMorten/MicrosoftGraphPS\n\n.PARAMETER Uri\nThis is the Uri for the REST endpoint in Microsoft Graph\n\n.PARAMETER Method\nThis is the method to handle the data (GET, PUT, DELETE, POST, PATCH)\n\n.PARAMETER Header\nThis is the Header coming from Connect-MicrosoftRestApiEndpointPS\n\n.INPUTS\nNone. You cannot pipe objects\n\n.OUTPUTS\nReturns the data\n\n.EXAMPLE\n$Result = Invoke-MicrosoftRestApiRequestPS -Uri \"https://api.securitycenter.microsoft.com/api/machines\" `\n                                           -Method GET `\n                                           -Headers $ConnectAuth[1]\n\n# Show Result\n$Result\n\n```\n\n\n\n## Get-MgUser-AllProperties-AllUsers\n\n```\n.SYNOPSIS\nPerforms a Get-MgUser for all users retrieving all properties (except for certain properties which cannot be returned within a user collection). \nManager property is being expanded\n\n.DESCRIPTION\nGet all properties for all users\nExpands manager information\nExcludes certain properties which cannot be returned within a user collection in bulk retrieval (*)\n\n(*)\nhttps://learn.microsoft.com/en-us/graph/api/user-list?view=graph-rest-1.0\u0026tabs=http#optional-query-parameters\n\nThe following properties are only supported when retrieving a single user: aboutMe, birthday, hireDate, interests, mySite, pastProjects, preferredName, \nresponsibilities, schools, skills, mailboxSettings, DeviceEnrollmentLimit, print, SignInActivity\n\n.AUTHOR\nMorten Knudsen, Microsoft MVP - https://mortenknudsen.net\n\n.LINK\nhttps://github.com/KnudsenMorten/MicrosoftGraphPS\n\n.INPUTS\nNone. You cannot pipe objects\n\n.OUTPUTS\nReturns the data\n\n.EXAMPLE\n\n$Result = Get-MgUser-AllProperties-AllUsers\n$Result | fl\n\n$Result.ManagerProperties | fl\n```\n\n","funding_links":[],"categories":["Tools"],"sub_categories":["CLI"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKnudsenMorten%2FMicrosoftGraphPS","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FKnudsenMorten%2FMicrosoftGraphPS","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKnudsenMorten%2FMicrosoftGraphPS/lists"}