Support a configurable or platform-appropriate location for .mg\mg.graphoptions.json
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- csharp, powershell
调研方向
从 Constants.cs 和 GraphSessionInitializer.cs 开始,跟踪 GraphDirectoryPath 和 GraphOptionsFilePath 的选择方式,然后检查 SetMgGraphOption.cs 及相关的身份验证常量。使用验收标准来定义受支持的配置、向后兼容性、独立的缓存处理、跨平台行为、文档和测试。
由索引模型根据 Issue 内容生成。
描述
Microsoft Graph PowerShell currently stores Graph SDK options at:
%USERPROFILE%\.mg\mg.graphoptions.json
The location is hard-coded in Microsoft.Graph.Authentication:
GraphDirectoryPath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
".mg");
GraphOptionsFilePath is then constructed beneath that directory.
Source references in tag v2.36.1:
src/Authentication/Authentication.Core/Constants.cssrc/Authentication/Authentication/Constants.cssrc/Authentication/Authentication/Common/GraphSessionInitializer.cssrc/Authentication/Authentication/Cmdlets/SetMgGraphOption.cs
This creates another tool-specific dot-directory directly under the user profile, with no documented environment variable or configuration setting for relocating it.
Environment
OS: Windows
Microsoft.Graph.Authentication: 2.36.1
Current path: %USERPROFILE%\.mg\mg.graphoptions.json
The file contains SDK configuration options such as:
DisableWAMForMSGraph
DisableLoginByWAM
No authentication-token relocation is being requested in this issue; the immediate request concerns configuration files such as mg.graphoptions.json.
Expected behavior
Provide a supported way to relocate Microsoft Graph PowerShell configuration.
Possible approaches:
- Add an environment variable such as
MSGRAPH_CONFIG_DIR. - Follow platform conventions by default:
- Windows:
%APPDATA%\Microsoft\GraphPowerShell - Linux/macOS:
$XDG_CONFIG_HOME/microsoft-graph, falling back to~/.config/microsoft-graph
- Windows:
- Preserve the existing
.mglocation for backward compatibility and migrate or fall back to it when appropriate.
Motivation
A configurable location would:
- Avoid adding application-specific directories to the profile root.
- Support enterprise-managed and portable PowerShell environments.
- Improve separation between configuration, cache, authentication state, and user data.
- Allow consistent backup and profile-management policies.
- Better align with platform conventions and the XDG Base Directory specification.
Existing related issue
#747 — Consider moving graph cache from .graph to .cache/graph to match XDG specification remains open.
That issue addresses Graph cache placement. This request is narrower and complementary: it covers the hard-coded .mg configuration directory and mg.graphoptions.json.
Acceptance criteria
- A documented setting or environment variable controls the Graph PowerShell configuration directory.
Get-MgGraphOptionandSet-MgGraphOptionuse the configured location.- Existing
.mgconfigurations continue working through migration or backward-compatible fallback. - Windows, Linux, and macOS path behavior is documented and tested.
- Configuration and cache locations can be controlled independently.
- 主要语言
- C#
- 星标
- 902
- 派生
- 233
- 平均合并
- 1 天 22 小时
- 30 天内合并 PR
- 29
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoftgraph/msgraph-sdk-powershell 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
microsoftgraph/msgraph-sdk-powershell#3752 ·
维护者通常 2 天内回复
-
status:waiting-for-triage type:bug
难度 4/5 3-5 天 新手友好度 22/100
microsoftgraph/msgraph-sdk-powershell#3822 ·
维护者通常 2 天内回复
-
status:waiting-for-triage type:bug
难度 4/5 3-5 天 新手友好度 48/100
microsoftgraph/msgraph-sdk-powershell#3819 ·
维护者通常 2 天内回复
-
Connect-MgGraph on 2.41 crashes when making a connection with cert, fixes when using 2.39 or lower未关闭status:waiting-for-triage type:bug
难度 4/5 3-5 天 新手友好度 48/100
microsoftgraph/msgraph-sdk-powershell#3816 ·
维护者通常 2 天内回复
-
status:waiting-for-triage type:feature
难度 4/5 3-5 天 新手友好度 45/100
microsoftgraph/msgraph-sdk-powershell#3806 · 3 条评论 · 3 个 reaction ·
维护者通常 2 天内回复
查看 microsoftgraph/msgraph-sdk-powershell 的全部 Issue
相似的 Issue
-
再現済み 要トリアージ 誤判定
难度 2/5 1-3 小时 新手友好度 72/100
yksr-melt/Meltype#421 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 64/100
Facepunch/sbox-public#12063 · 1 条评论 ·
维护者通常 2 天内回复
-
documentation
难度 2/5 1-3 小时 新手友好度 84/100
facioquo/stock-indicators-dotnet#2316 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
lostindark/DriverStoreExplorer#477 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
eriknihlen/OpenAC#219 ·
维护者通常 1 天内回复