Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Microsoft.Graph.Authentication is very large. How can we slim it down?

未關閉
#3,347 3 則留言 0 個 reaction 已指派 1 人 在 GitHub 檢視

維護者通常 1 天內回覆

@ramsessanchez 已經在處理了。

開始於 2025年11月10日。

評估

這個 Issue 還沒有評估資料。

描述

type:feature
Is your feature request related to a problem? Please describe the problem.

Follow-up of #3345.

All of Microsoft.Graph.* depends on Microsoft.Graph.Authentication, weighing in at a whopping 42.1 MB on-disk with version 2.28.

Serverless environments frequently limit customers' space to deploy dependencies in. The PowerShell runtime+MS.Graph.Authentication is over 200MB of dependencies without having written any code, which poses several challenges for hosting/deployment.

There's been a lot of good discourse about the size of this SDK over the years (#692 #2475 #2516) - these have focused on either:

  • The total size of the SDK, across all modules
    • (MSGraph isn't that much bigger than AWS.Tools or Az)
  • Individual modules hitting landmark size limits
    • (Not everyone uses those specific modules)

Even outside those two scenarios, module size is still a problem.

Comparing 3 separate auto-generated families of PowerShell modules:

Metric Az AWS.Tools Microsoft.Graph
Total Module Count 93 410 47
Total Installed Size1 514 737 1060
Median Module Size 3.1 1.2 9.5
Core2 Module Size 28.6 16.7 42.1
Core : Total Module Size 5.6% 2.3% 3.9%
"Average" Install3 Size 31.7 17.9 51.6

1: All sizes in MB
2: Az.Accounts, AWS.Tools.Common, Microsoft.Graph.Authentication
3: Core module, plus single non-core (represented by median)

One "average" MSGraph module (with dependencies) is ~30% the size of the entire PowerShell Runtime on Linux. (~172MB)

Currently, Microsoft.Graph.Authentication has ~25MB of JSON used for Find-MgGraphCommand and Find-MgGraphPermission. These cmdlets appear to be for human-focused discovery/investigation and not required for authentication/API calls. Moving these off the critical dependency-path could save a ton of space for non-interactive scenarios.

Describe the solution you'd like.

TL;DR: Reduce .Authentication footprint to strict requirements for Invoke-MgGraphRequest or the other Microsoft.Graph.* modules. Move Find-MgGraph* to a separate module for interactive discovery.

Some options (neither exhaustive nor mutually exclusive) for making this work could look like:

  • Move Find-MgGraphCommand and Find-MgGraphPermission to a separate module and add the module as a dependency of Microsoft.Graph.
  • Replace Find-MgGraphCommand and Find-MgGraphPermission in Microsoft.Graph.Authentication with stubs to call corresponding commands in Microsoft.Graph.CommandDiscovery, without setting explicit dependency relationships.
  • De-couple Find-MgGraph* entirely from the rest of .Authentication.
    • Split Microsoft.Graph.Authentication into two modules (.Common and .CommandDiscovery, perhaps)
    • Update .Authentication depend on .Common and .CommandDiscovery
    • Update other child modules to depend on .Common
Additional context?

No response

主要語言
C#
星號
901
分支
232
平均合併
1 天 5 小時
30 天內合併 PR
20

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

microsoftgraph/msgraph-sdk-powershell 的其他 Issue

查看 microsoftgraph/msgraph-sdk-powershell 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。