
m365pnp/powershellPnP.PowerShell是一个基于.NET 8的PowerShell模块,提供近800个cmdlet,用于Microsoft 365环境(如SharePoint Online、Microsoft Teams、Microsoft Project、安全与合规中心、Entra ID等)的管理与自动化。通过Docker容器化部署,可便捷地在隔离环境中运行PnP.PowerShell,实现Microsoft 365管理任务的自动化执行。
latest:最新稳定版镜像(与stable标签等价)bashdocker pull m365pnp/powershell # 或显式指定标签 docker pull m365pnp/powershell:latest docker pull m365pnp/powershell:stable
nightly:最新夜间构建版镜像(包含最新开发特性,稳定性未经验证)bashdocker pull m365pnp/powershell:nightly
运行一个安装了最新稳定版PnP.PowerShell模块的隔离容器,直接进入交互模式:
bashdocker run --rm -it m365pnp/powershell
说明:
--rm表示容器退出后自动删除,-it启用交互终端。
将本地目录挂载到容器中,以便访问本地文件(如脚本、配置)。
bash# 将当前目录(${PWD})挂载到容器的/home目录,并设置工作目录为/home docker run --rm -it -v ${PWD}:/home -w /home m365pnp/powershell
PowerShell# 将当前目录(${PWD})挂载到容器的c:/app目录,并设置工作目录为c:/app docker run --rm -it -v ${PWD}:c:/app -w c:/app m365pnp/powershell
直接在容器中执行本地存储的PnP.PowerShell脚本,无需进入交互模式。
bash# 将当前目录挂载到容器的/scripts目录,运行脚本script-to-run.ps1 docker run --rm -v ${PWD}:/scripts -w /scripts m365pnp/powershell script-to-run.ps1
PowerShell# 将当前目录挂载到容器的c:/scripts目录,运行脚本script-to-run.ps1 docker run --rm -v ${PWD}:c:/scripts -w c:/scripts m365pnp/powershell script-to-run.ps1
镜像标签遵循以下格式:
<version>[-nightly/-stable]-<architecture>
<version>:模块版本号(如3.1.127),省略时表示最新版。-nightly/-stable:可选,指定构建类型(nightly为夜间构建,stable为稳定版),省略时默认稳定版。<architecture>:可选,指定硬件架构,省略时自动匹配当前环境架构。| 架构标签 | 基础环境说明 | Dockerfile链接 |
|---|---|---|
| linux-amd64 | Alpine Linux 64位 | linux-amd64.dockerfile |
| windows-amd64 | Windows NanoServer LTSC 2025 64位 | windows-amd64.dockerfile |
| linux-arm32 | .NET SDK 9 32位(适用于Raspberry Pi 2 v1.1及更早运行32位Linux的设备) | linux-arm32.dockerfile |
| linux-arm64 | Linux Debian Bullseye Slim 64位(适用于Raspberry Pi 2 v1.2及更新运行64位Linux的ARM设备) | linux-arm64.dockerfile |
| 标签名称 | 说明 |
|---|---|
| nightly | 自动匹配架构的最新夜间构建版 |
| stable/latest | 自动匹配架构的最新稳定版(两者等价) |
| 3.1.127-nightly | 自动匹配架构的3.1.127版本夜间构建版 |
| 3.1.127-nightly-windows-amd64 | 强制使用Windows amd64架构的3.1.127版本夜间构建版 |
| 3.1.0-stable | 自动匹配架构的3.1.0版本稳定版 |
| 3.1.0-stable-linux-amd64 | 强制使用Linux amd64架构的3.1.0版本稳定版 |
模块版本号可通过 PowerShell Gallery 查询。
如对PnP.PowerShell模块功能或镜像构建有反馈需求,可通过 PnP/PowerShell GitHub仓库 提交issue。
manifest unknown 错误
TLS 证书验证失败
DNS 解析超时
410 错误:版本过低
402 错误:流量耗尽
身份认证失败错误
429 限流错误
凭证保存错误
来自真实用户的反馈,见证轩辕镜像的优质服务